HTML5 历史 API
我如何使用 HTML5 历史 api。我确实浏览了 https://developer.mozilla.org/en/DOM/Manipulated_the_browser_history。这让我很困惑。我想要的只是更改 ajax 调用上的 url,以便当用户点击后退按钮时他可以获得之前的状态。
我也想知道这有什么陷阱。何时使用、何时不使用。如何最好地使用jquery
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是我遇到的最好的资源(包括您已经提到的资源和工作代码示例):
关于陷阱给出“智能状态处理”链接值得一读。关于向后兼容性,有 History.js 修复了浏览器错误并提供了可选的 HTML4 哈希倒退。
Here are the best resources which I've come across (including the one you already mentioned, and a 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.
我认为免费在线书籍 Dive into HTML5 通常是描述 HTLM5 新功能的绝佳来源。它有一个关于新历史元素的章节,操纵历史以获得乐趣和乐趣。利润。
执行摘要是,它不仅仅是一个使这项工作正常工作的在线线路。当您使用 AJAX 假装加载新页面时,您还必须在用户单击后退按钮时假装加载上一页。
I think the free online book Dive into HTML5 is generally an excellent source for a description of the new features of HTLM5. It has a chapter about the new history element, Manipulating History for Fun & Profit.
The executive summary is that it is not just a online-liner to make this work correctly. When you fake loading a new page using AJAX you also have to fake loading the previous page when the user clicks on the back button.