The jQuery History Plugin (http://www.mikage.to/jquery/jquery_history.html) is said to work with Chrome:
http://github.com/tkyk/jquery-history-plugin
Supported Browsers IE6, IE7, IE8, Firefox3, Safari4, Safari5, Chrome4, and Chrome5
but then when i go to the top link mentioned above, if I click on load 1, load 2, and then load 3, the back button will change the URL's hash portion to #2
, but the "Loaded html:开发者_运维技巧" section still shows "3"… anybody know why?
Go here for a current sample page: http://www.serpere.info/jquery-history-plugin/samples/
It works in Chrome ;) As Pointy, well, points out, the code on that page isn't current, there are several changes/fixes in GitHub since then. You can get the latest source here.
Note that the API changed (for the better I think) since that old page, for example:
$.historyInit
is now$.history.init
$.historyLoad
is now$.history.load
- etc, see a full list of changes in this commit
The version used by that demo page is not the same as the github version.
Perhaps try this jQuery History plugin: http://www.balupton.com/sandbox/jquery-history/demo/ It provides cross browser support, binding to hashes, overloading hashes, all the rest.
There is also a Ajax extension for it, allowing it to easily upgrade your webpage into a proper Ajax application: http://www.balupton.com/sandbox/jquery-ajaxy/demo/
This is the solution chosen by such sites as http://wbhomes.com.au/ and http://gatesonline.com.au/stage/public/
Overall it is well documented, supported and feature rich. It's also won a bounty question here How to show Ajax requests in URL?
精彩评论