Basically, I am trying to check if the previous page on every route was equal to one specific page on my site. If it is, then I want to keep the person on that view, otherwise, they can proceed to the other view.
Is there a way in a Backbone.js router, to fire off a global event that will fire before the route callback is executed?
Or, is there a way to have a catch all route that does some checking then forwards to the appropriate route.
I think overridding
Backbone.History.navigateand only invoking the superclass method conditionally might work. You could also add an additional event handler forwindow.hashChangeandwindow.pushStateevents wired up before the backbone history, and prevent the default propagation of those events if your criteria match.