Skip to content

Instantly share code, notes, and snippets.

@phatduckk
Last active September 28, 2017 16:30
Show Gist options
  • Save phatduckk/51f05ef9e065a121e4c9121879874e20 to your computer and use it in GitHub Desktop.
Save phatduckk/51f05ef9e065a121e4c9121879874e20 to your computer and use it in GitHub Desktop.
function redirectDefault(url, urls) {
var iframe = document.createElement("iframe");
iframe.style.border = "none";
iframe.style.width = "1px";
iframe.style.height = "1px";
iframe.onload = function() {
redirect(redirectDefault, urls);
};
iframe.src = url;
// If we're still loading the document, wait before doing this
ensureLoadedThen(function() {
document.body.appendChild(iframe);
});
}
function redirectWeb() {
window.location = urls[urls.length - 1];
}
if (!checkAlreadyInvoked()) {
invoke();
}
function checkAlreadyInvoked() {
var invokedCookie = "fb45d8cf63156e060cd952e5a2576f41" + "_invoked";
if (document.cookie.indexOf(invokedCookie + "=") !== -1) {
return true;
} else {
document.cookie = invokedCookie + "=true; expires=" + new Date(Date.now() + 300000).toGMTString();
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment