Damn, history web API really sucks for SPAs that have a hierarchical navigation structure.

For example there's no built-in way to know whether the back or forwards button were clicked, only that one of them was clicked.

And if you reload the page, any state you pushed remains in the history stack. So the user might not be able to go back in your application anymore, but they can still press the browser back button and all those states you pushed will be fucking up your navigation system

  • 1
    Yeah had this issue as well 😕 I guess we're just not supposed to that in a browser. But I guess it makes sense that you're not able to "hijack" the back button or do weird things like some ad sites do...
  • 1
    @ScriptCoded Google be like "use SPAs.... but don't"
  • 0
    You can pop the navigation stack when the in-app back button is pressed, so there should be no history entries that were created by the back button. It should only ever destroy the most recent history entry(ies)
Add Comment