开发者

"browser back" possible without reloading page (AJAX)

开发者 https://www.devze.com 2022-12-09 07:58 出处:网络
Im using ajax to开发者_如何学Python call php which gets results from a mysql db. Reason im using ajax is so that the page wont reload. (RETURN FALSE)

Im using ajax to开发者_如何学Python call php which gets results from a mysql db. Reason im using ajax is so that the page wont reload. (RETURN FALSE)

All works fine, but since the browser doesnt reload, there is no "back".

Example: Users enter something to search for, and hits "search button" and ajax returns the search without reloading page, BUT if the user wants to click the back button to get to the previous search, they cant...

If you think it would be better to actually reload the page then tell me because this is fully possible for me, only reason I dont reload page is because it looks better this way...

Or what do you guys think of iframes?

Thanks!


Take a look at this tutorial entitled "Fixing the Back Button and Enabling Bookmarking for AJAX Apps".


In conjunction with the answer to your question here, you could store their searches in an array. In the unload event, you could just do the previous search.


You can use jquery history plugin for this:


Try this simple & lightweight PathJS lib. It allows to bind listeners directly to anchors.

Usage example:

Path.map("#/page1").to(function(){
    ...
});

Path.map("#/page2").to(function(){
    ...
});

Path.root("#/mainpage");
Path.listen();
0

精彩评论

暂无评论...
验证码 换一张
取 消