MediaWiki:Common.js: Difference between revisions
fixed the mobile redirect so it actually sticks now Tag: Reverted |
cleaned up some dead code from the mobile fix Tag: Reverted |
||
| Line 7: | Line 7: | ||
// redirecting. | // redirecting. | ||
// | // | ||
// The | // The server does set a loop-guard cookie on the toggle ("stopMobileRedirect"), | ||
// but it's HttpOnly (confirmed by testing), so client-side JS can never | |||
// | // actually read it - that check would always be dead code. sessionStorage | ||
// | // is the only guard we can use here, wrapped in its own try/catch so a | ||
// | // browser that blocks storage access (some in-app/embedded browsers do) | ||
// | // doesn't cancel the whole redirect and strand the user on Minerva. | ||
// | |||
(function () { | (function () { | ||
try { | try { | ||
if (!document.body || !document.body.classList.contains('skin-minerva')) return; | if (!document.body || !document.body.classList.contains('skin-minerva')) return; | ||
var alreadyTried = false; | var alreadyTried = false; | ||
try { alreadyTried = !!sessionStorage.getItem('wovForcedDesktop'); } catch (e) {} | try { alreadyTried = !!sessionStorage.getItem('wovForcedDesktop'); } catch (e) {} | ||