HTML5的历史APi [英] HTML5 history APi
问题描述
我如何使用HTML5历史API。我的确经历了 https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history。这使我困惑。我想要的只是更改ajax调用的url,以便当用户点击后退按钮时,他会获得以前的状态。
我也知道这个坑有什么变化。何时使用以及何时不使用。如何最好地使用jquery
以下是我遇到的最佳资源(包括您已经提到的资源,和一个工作代码示例):
关于陷阱,给出智能状态处理链接一个很好的阅读。关于向后兼容性, History.js 修复了浏览器错误,并提供了可选的HTML4哈希倒退。
How do i use HTML5 history api. I did go through the https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history. That confused me. All that i want is to change the url on ajax calls so that when user hits the back button he gets the previous state.
Also i wnat to know of any pit falls of this . When to use and when not to use. How best to use with jquery
Here are the best resources which I've come across (including the one you already mentioned, and a working code example):
- MDC: Manipulating the Browser History - very basic native example
- Dive into HTML5: Manipulating the HTML5 History API for Fun and Profit - good intro
- Intelligent State Handling: - article about hashbangs VS hashes VS HTML5 History API - provides working code solutions.
- Ajaxify a Website with the HTML5 History API using History.js and ScrollTo - working code example
In regards to pitfalls give the "Intelligent State Handling" link a good read. In regards to backwards compatibility there is History.js which fixes the browsers bugs and provides an optional HTML4 hash fallback.
这篇关于HTML5的历史APi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!