javascript page redirect

this one i cant add a working demo for, due to its nature, but it is working if you remove the comment.

combine this with this:

https://kruxor.com/view/code/wQUDM/do-something-later-with-settimeout-or-loop-with-setinterval/

to redirect after a certain time. 

 

Javascript

// you may need to add some time out, and wait for the page scripts to load to get this working correctly with set timeout. 


// both of these are valid page redirects
// window.location.replace("https://kruxor.com/");
// window.location.href = "https://kruxor.com/";

// wait 1 second (1000ms) and do a redirect
function redirect(url) {
  	console.log("if the proceeding line is uncommented it should redirect to kruxor.com");
	// window.location.href = "https://kruxor.com/";
}

setTimeout(redirect("https://kruxor.com"), 1000);

Other Items in javascript

No Items Found.

Add Comment
Type in a Nick Name here
 
Page Views

This page has been viewed 169 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

โค๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ•น

Random Quote
All of humanity's problems stem from man's inability to sit quietly in a room alone, wrote Blaise Pascal.
Unknown