I have inherited a half-finished mobile app built using Backbone.js (which I have never used).
I need, quite simply, to send the user back when they click a back button.
Some brief research leads me to believe it has something to do with Backbone.history
but I can't figure out what.
Any ideas?
This is the only method which can be used to manipulate the BackboneJS-History. It starts listening to routes and manages the history for bookmarkable URL's. options − The options include the parameters such as pushState and hashChange used with history. Save the above code in the start.htm file.
The back () method loads the previous URL in the history list. This is the same as clicking the "Back button" in your browser. Note: This method will not work if the previous page does not exist in the history list. Tip: To load the next URL in the history list, use the history.forward () method.
The back() method loads the previous URL in the history list. This is the same as clicking the "Back button" in your browser, or history.go(-1). Note: This method will not work if the previous page does not exist in the history list. Tip: To load the next URL in the history list, use the history.forward() method.
History back () Method 1 Definition and Usage. The back () method loads the previous URL in the history list. This is the same as clicking the "Back button" in your browser. 2 Browser Support 3 Technical Details
Unless the app uses the fancy-schmancy HTML5 pushState
events, I don't see a need for Backbone.History
here. Just use window.history.back()
.
Nowadays you can also use some more Backbone with Backbone.history.history
which provides you methods like .forward
, .go
and finally Backbone.history.history.back()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With