Add an event called statechange
that will fire on any change to the history stack, whether that be through the browser's back button, or window.history.pushState
or other methods.
This proposed event would be similar to popstate
, except that it would fire on all route changes regardless of the source, much like hashchange
fires on all hash changes regardless of the source.
hashchange
events allowed javascript router libraries (e.g. React Router, vue-router) to easily respond to any routing event when the application is using hash routing.