Created
May 15, 2019 16:27
-
-
Save schalkneethling/08e8596b5956984335ac703de79290c2 to your computer and use it in GitHub Desktop.
Allow posts from beta domain
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 setupConfig() { | |
// assume production as origin | |
var origin = "https://developer.mozilla.org"; | |
// get the actual parent origin | |
var parentOrigin = window.parent.location.origin; | |
// is it the beta domain? | |
if (parentOrigin.search(/beta.developer.(mozilla|allizom)/) > -1) { | |
// then use it as the origin | |
origin = parentOrigin; | |
} else if (window.URL) { | |
// look for the search param | |
var url = new URL(window.location.href); | |
if (url.searchParams) { | |
var param = url.searchParams.get("origin"); | |
if (param) { | |
// and use it as the origin | |
origin = param; | |
} | |
} | |
} | |
// finally set the config | |
window.ieConfig = { | |
origin: origin | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment