Skip to content

Instantly share code, notes, and snippets.

@olivmonnier
Created February 12, 2015 13:44
Show Gist options
  • Save olivmonnier/6b9a9829b6e49d9e126a to your computer and use it in GitHub Desktop.
Save olivmonnier/6b9a9829b6e49d9e126a to your computer and use it in GitHub Desktop.
Redirect page
<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