-
-
Save felixlaumon/9620384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
try { | |
var orcWidth = parseInt(window.location.search.match(/width=(\d+)/)[1], 10); | |
var orcHeight = parseInt(window.location.search.match(/height=(\d+)/)[1], 10); | |
var hasFailed = window.location.search.match(/oswidthheight=(\w+)/); | |
if (hasFailed && hasFailed.length) { | |
console.log('ignore width height verification because it has failed once before'); | |
return; | |
} | |
if (orcWidth !== window.innerWidth || orcHeight !== window.innerHeight) { | |
// If browse and Orc dimension do not match up, reload but without the | |
// width, height and size query string and hash | |
var search = window.location.search | |
.replace(/width=\d+&?/, '') | |
.replace(/height=\d+&?/, '') | |
.replace(/size=\w+&?/, ''); | |
search += '&oswidthheight=failed'; | |
var newUrl = window.location.protocol + '//' + window.location.host + window.location.pathname + search; | |
window.location.href = newUrl; | |
} | |
} catch (e) { | |
console.error('Failed to verify dimension from Orc', e); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment