Skip to content

Instantly share code, notes, and snippets.

@DustinAlandzes
Created April 27, 2018 20:44
Show Gist options
  • Save DustinAlandzes/4fc78b9adf60ac404b6c975528cc89a1 to your computer and use it in GitHub Desktop.
Save DustinAlandzes/4fc78b9adf60ac404b6c975528cc89a1 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Redirecting</title>
<script>
// We take in the url and delay parameters
// set window.location to "url", after "delay" milliseconds
//https://davidwalsh.name/query-string-javascript
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
function redirect()
{
console.log("redirect")
if(getUrlParameter('url') == null){
window.location.replace("http://www.yourlocalmention.com/access-point/?venueId=42");
}else{
window.location.replace(getUrlParameter('url'));
}
}
window.onload = function(){
console.log('This alert is from onload event');
if(getUrlParameter('delay') == null){
setTimeout(redirect, 2000);
}else{
setTimeout(redirect, getUrlParameter('delay'))
}
}
</script>
</head>
<body>
<iframe id="neverssl_iframe" src="http://www.neverssl.com/">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment