History Plugins (jQuery or AJAX history usage in general)
UPDATED Question: 5/19/11 NOTE: for complete newbies like myself - take a look at this first to see if it helps, i found it very useful!
- jQuery History Plugin
- http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
Original Question:
I am relatively inexperienced in web design, but have been working on implementing a History solution on my new website.
Note: I have now looked at the solutions in the link above - jQuery.History @ http://tkyk.github.com/jquery-history-plugin/ seemed to work for me but there are a lot of options!
I've done some reading, gotten some good input below (thank you!), and now kind of understand the reasoning T9b refers to below; you can't do my original question - that makes some sense now.
In General: there is Page History, and Element History as i now understand it.
Original Question #1: example: I wanted to load PageA.html, #divA1 instead of the whole PageA.html into my #content div on my main page and use a history solution.
- can't do that, because you are mixing Page History (PageA.html) and Element History (#divA1).
Answer #1: If i want to use a "history" solution (back, forward, bookmarks, etc...) i would actually have to create a separate (new) divA1.html file - basic requirement of the way history type solution work.
Question #2:
I started looking at some of the items in the answer below - Sessions will probably be too complicated for me, sorry. So
- is there a link to an example of setting up an index array in javascript specifically for a history type application like suggested below?
- Understanding (this will not store information if the browser is refreshed, or bookmarked, which i think is correct?)
- But will that allow back, forward for the user while they are navigating a page say that has multiple content that is loading from hidden div's within the page?: (unless they refresh the page, etc..., which I think is what T9b is saying below?)
Again, thank you for your patience - I'm sure these are not the smartest questions but I'll keep reading etc... and trying to get better, appreciate all the hel开发者_如何学Cp so far!
If I understand you correctly - you are loading another page on your site into a scrollable div (for example in the place of using an iframe?) and you want to know the history of those loads so that you could navigate freely backwards and forwards like you would do in the browser? But you are having problems with the .history()
plugin because it only deals with the page as a whole and not the contents of the div.
Righto. If I have understood this correctly then I think your best bet would be initially to just store the history in an array with an index and a variable and then use the index to determine where you currently are against where you last were. But that depends on how long you want to make the history available. It will be lost as soon as you refresh the page or leave the site.
If you want it to persist longer then you will also have to look into stocking the history on the server, perhaps using sessions.
It's not entirely clear what you are trying to do, and I may have completely misunderstood!
For general introduction see this guide to Html5 History API: http://diveintohtml5.info/history.html
Html5 allows you to modify "real" history, i.e. you don't need to rely on hash-tags. It is not compatible with all versions of all the browsers, which is why you might need HistoryJS (which is a successor to jQuery history plugin)
If you still have questions after that, I recommend you ask them right away, but be more specific as to what you want to achieve (e.g. post the exact problem you are having or the place you are stuck on).
精彩评论