window.addEventListener('popstate', () => { window._popStateDetected = true; });