I have a list of items in #/xxx
which when clicked will pop up a lightbox and change the hash to #/xxx/yyy
. In the lightbox, there's a "Back" button. How do I revert to previous page (i.e. "#/xxx
")? I'm looking for something like "Backbone.back()
". This action must not trigger the route handler (otherwise the list of items will be empty since it's an Ajax search result).
There's two easy ways I can think of doing this:
1) Make the "back" button not really go back at all, just repeat the previous route (the one prior to bringing up the lightbox) again. Then going backwards and forwards through the history will produce the results you expect to see.
2) Just tell the browser to step back one step within the history. You can do that in JavaScript like so:
window.history.back();
Results should be just like the other way of doing the same thing.