Skip to content

Instantly share code, notes, and snippets.

@emjayess
Created July 20, 2010 17:16
Show Gist options
  • Save emjayess/483240 to your computer and use it in GitHub Desktop.
Save emjayess/483240 to your computer and use it in GitHub Desktop.
//artificially delay a javascript redirect w/anonymous function
//n represents delay in seconds
(function(){
var i,c=0,n=3;
i=window.setInterval(function(){
if(c++==n){
window.clearInterval(i);
top.location='http://redirect-here.tld/';
}
},1000);
})();
@emjayess
Copy link
Author

see also: @cowboy ben alman's doTimeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment