Backbone.js: How to utilize router.navigate to manipulate browser history?
Posted
by
Xavier_Ex
on Stack Overflow
See other posts from Stack Overflow
or by Xavier_Ex
Published on 2012-12-09T21:01:11Z
Indexed on
2012/12/09
23:04 UTC
Read the original article
Hit count: 151
backbone.js
|pushstate
I am writing something like a registration process containing several steps, and I want to make it a single-page like system so after some studying Backbone.js is my choice.
Every time the user completes the current step they will click on a NEXT button I create and I use the router.navigate method to update the url, as well as loading the content of the next page and doing some fancy transition with javascript.
Result is, URL is updated which the page is not refreshed, giving a smooth user experience. However, when the user clicks on the back button of the browser, the URL gets updated to that of a previous step, but the content stays the same. My question is through what way I can capture such an event and currently load the content of the previous step and present that to the user? Or even better, can I rely on browser cache to load that previously loaded page?
EDIT: in particular, I'm trying something like mentioned in this article.
© Stack Overflow or respective owner