Yann asked me about navigation history at the html page with active structures, which can collapse and expand. So I tried to write several posts about this issue.
Any modern browser has navigation history. And it is cool to be able to navigate through history at the script-driven html page. For instance accordion control without history is abnormal today.
How could we get required functionality and in the same time not change site page?
The answer is anchor! This is a small part of URL, after all host/site/folder/params information. It looks like symbol "#" and next any valid html encoded string after it: www.trololo.su/home#foo=1
If we change address to www.trololo.su/home#foo=2, browser will stay on the page. Window object will raise event "hashchange" and we can hold anchor change.
Profit!
No comments:
Post a Comment