Comment on Browser History (2013)Comments−panic9yYou 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/pageshowMore 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.
Comments
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.