1/** 2 * Fixes the "broken page on Back" issue across the system and public sites. 3 * 4 * Many forms (contact, registration, purchase) render their result inline on a 5 * POST response instead of redirecting. When the user later navigates Back to 6 * such a page the browser tries to re-display the stored POST response, which 7 * shows a broken / expired page. Pages restored from the back/forward cache 8 * (bfcache) can also come back with stale, non-functional JS state. 9 * 10 * On any back/forward navigation (or a bfcache restore) we re-fetch the page 11 * with a clean GET via location.replace(), so Back always lands on a freshly 12 * rendered, working page. replace() (not reload()) avoids re-issuing the 13 * original POST and keeps history clean. 14 */ 15(function () { 16 if (window.__atarixBackForwardReload) { 17 return; 18 } 19 window.__atarixBackForwardReload = true; 20 21 function isBackForward() { 22 try { 23 var navEntries = (window.performance && performance.getEntriesByType) 24 ? performance.getEntriesByType('navigation') 25 : null; 26 if (navEntries && navEntries.length && navEntries[0].type === 'back_forward') { 27 return true; 28 } 29 // Legacy fallback (older browsers). 30 if (window.performance && performance.navigation && 31 performance.navigation.type === 2 /* TYPE_BACK_FORWARD */) { 32 return true; 33 } 34 } catch (e) {} 35 return false; 36 } 37 38 window.addEventListener('pageshow', function (event) { 39 if (event.persisted || isBackForward()) { 40 window.location.replace(window.location.href); 41 } 42 }); 43})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.