4

Before the days of the history API, it was common to use window.location.hash to set the hash in the address bar, and onhashchange to listen to the user editing the hash in the address bar manually, both without causing a page reload. Now, with the history API, it's possible to change the whole URL via history.pushState and such, but I don't know of a way to listen to the user editing the whole URL in the address bar manually. Is there an analogue to onhashchange that can catch manual changes to the address bar, and cause updates to the page without reloading? Obviously, for security reasons, this can't possibly exist if the user were to change the domain, but I'm wondering if a way exists if the domain remains the same.

0 Answers0