Maintaining Browser History when changing page content via Ajax

风流意气都作罢 提交于 2019-12-22 10:38:38

问题


As the title suggests I want to maintain browser history when I am changing the page via Ajax.

Now, each page has a corresponding action and/or URL Parameter so it is possible to navigate directly to each page via the URL but because I am changing the page using Ajax the browser's history and URL does change.

Think of Google Instant. Your not changing page between searches but the back/forward functionality of the browser is maintained. Any ideas how to do this (jQuery methods especially useful)


回答1:


Try here: http://ajaxpatterns.org/Unique_URLs




回答2:


HTML5 introduces the pushState() function that allows for a manipulation of the browser history entries. For jQuery, there is jQuery BBQ: Back Button & Query Library which looks very promising, although I have no personal experience with it.



来源:https://stackoverflow.com/questions/4803100/maintaining-browser-history-when-changing-page-content-via-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!