Hacker News new | ask | show | jobs
by panic 3559 days ago
You can use the pageshow event to detect when the browser navigates back in history to a page in the back/forward cache: https://developer.mozilla.org/en-US/docs/Web/Events/pageshow

More generally, you shouldn't make a "single-page app" unless you really need to. The web is designed for navigating between multiple documents. Browser features like history and bookmarks will work better if you stick to the standard behavior.