问题
I'm seeking a javascript history framework to handle navigation inside a page when the user selects multiple options which change the page behaviour.
There are multiple artefacts on the page that change the data loading of the page and I'd like to store this as a stacked set of behaviour. In a wider sense, I'd like to add this as a toolkit to my future web projects for the same reasons.
I'm primarily writing in ASP.NET with JQuery but I'm only really worried about JQuery for now. I do write other projects in PHP, Python and Perl (depending on the gig) so it would have to be platform agnostic.
I've been looking on the net and have found a few but only one (covered on OReilly) looked like it would fit the bill. I have started playing with it but I wanted to know what toolkits other people were using and what others would recommend.
So if you have any experience of history frameworks, handling the back button (etc) in Ajax I'd love to hear about what you've used and how it worked out. It would really help me make a final choice on library.
Thanks,
S
回答1:
I had the similar problem a while ago building a flash only site. We tried:
- Really Simple History (which had some problems in combination of safari and flash)
- ExtJS which has a history component which worked great for us. (Demo) [Beside we have used this framework already for other projects.]
回答2:
Maybe this question is usefull to you. In the question I linked to a testpage, where location.hash is used to keep track of the history. I am currently using this method in a testsite and experienced problems with Opera (truncates a location.hash value at the question mark, you'll have to use: location.href.split(/#/)[1]
) and of course IE (needs an iframe). In IE with iframe the history is saved for the current session only. If you load another page in the same window/tab and use the back button to go back to the AJAX page, the previous history is lost. It's not that big a deal for me, but may be annoying. I understood that IE8s history should behave like expected with location.hash, it even should have a hashchange handler.
I think most of the frameworks use the same technique (monitoring location.hash for changes, using an iframe for IE). I didn't want to use a framework, because I'm using my own home brew small framework and regular frameworks contain too much functionallity I'll never use.
回答3:
jQuery History is my preferred choice. It can be found here: http://www.balupton.com/projects/jquery-history/ Provide cross browser support, binding to hashes, overloading hashes, all the rest.
There is also an Ajax extension for it called jQuery Ajaxy, allowing it to easily upgrade your webpage into a proper Ajax application without need for server side changes and remaining SEO and JS-Disabled friendly: http://www.balupton.com/projects/jquery-ajaxy/
Overall they are both well documented, supported and feature rich. They've also won a bounty question here How to show Ajax requests in URL?
回答4:
Dial.js is a JavaScript browser history framework designed to provide some of the features of a full-fledged MVC framework with jQuery and History.js for single-page applications (SPAs).
来源:https://stackoverflow.com/questions/657310/experiences-with-javascript-history-frameworks