Created
February 12, 2015 13:44
-
-
Save olivmonnier/6b9a9829b6e49d9e126a to your computer and use it in GitHub Desktop.
Redirect page
This file contains 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
<div> | |
<h1 class="text-center">Veuillez patienter pendant la redirection...</h1> | |
<p class="text-center"><a id="linkDirect" class="btn btn-primary" href="#">Accès direct</a></p> | |
</div> | |
<script> | |
function getParamsUrl(){ | |
if(window.location.search.length > 0){ | |
return JSON.parse('{"'+ | |
decodeURIComponent(window.location.search).slice(1) | |
.split("=").join('":"') | |
.split("&").join('","') | |
+'"}'); | |
} | |
} | |
function addhttp(url) { | |
if (!/^(f|ht)tps?:\/\//i.test(url)) { | |
url = "http://" + url; | |
} | |
return url; | |
} | |
var paramsUrl = getParamsUrl(); | |
if(!paramsUrl){ | |
paramsUrl = {}; | |
paramsUrl.link = "<%= business_home_url %>"; | |
} | |
$('#linkDirect').attr('href', addhttp(paramsUrl.link)); | |
setTimeout(function(){ | |
document.location.href = addhttp(paramsUrl.link); | |
}, 3000); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment