Best Jquery ,javascript, HTML5 CSS3 tutorial with jquery examples, php script , demos for beginners, web designers and web developers.

Jquery

Jquery Training

Jquery training blog

How to redirect to a page after 5 second in pure javascript

How to redirect a page after sometime in pure javascript. There are several ways to redirect a page in javascript and jquery after sometime. The below example showing how to redirect a page after sometime in pure javascript. <!DOCTYPE html><!DOCTYPE html> <html> <head> <title>Rediret to google.com</title> </head> <body> <p>You will be redirected in <span id=”redirect”>5</span> Continue Reading


How to redirect a page after sometime in pure javascript. There are several ways to redirect
a page in javascript and jquery after sometime. The below example showing how to redirect a 
page after sometime in pure javascript.

<!DOCTYPE html><!DOCTYPE html>

<html>

<head>

<title>Rediret to google.com</title>

</head>

<body>

<p>You will be redirected in <span id="redirect">5</span> second.</p>

<script> document.addEventListener("DOMContentLoaded", function(event) {

window.setInterval(function() {

var timeLeft    = document.getElementById('redirect').innerHTML;

if(eval(timeLeft) == 0){

window.location.href="http://www.google.com";

}else{

document.getElementById('redirect').innerHTML=eval(timeLeft)- eval(1);                   }    }, 5000); });

</script>

</body>

</html>
Please follow and like us:






About the author

Joydeb Choudhury holds a Master's degree in Computer Application from I.G.N.O.U. After working as a web developer in various companies he has started bloging in 2016.

Recent Posts of blog

Downalod Free Php Scripts