I have url redirection script or url refer script.
I want to add 5 second waiting and then url redirect to desired url.
<script>
var url_index = window.location.href.indexOf('url=');
if (url_index != -1)
{
url_go = window.location.href;
url_go = url_go.substring(url_index + 4);
//document.write(url_go);
window.location.href = url_go;
}
var $_ = function(x){if(!document.getElementById){return;} else{ return document.getElementById(x);}}
</script>
Output is http://transistortechnology.blogspot.com?url=http://imgur.com
When I open above url then it redirect suddenly, but I want add 5 second wait.
Is it possible in above script code.
I put that script in blogger header section
See: Javascript – Wait 5 seconds before executing next line
Based on that, the following should probably work:
url_go = "" function doRefer() { var url_index = window.location.href.indexOf('url='); if (url_index != -1) { url_go = window.location.href; url_go = url_go.substring(url_index + 4); setTimeout(function () {window.location.href = url_go;}, 5000); } }