Jquery Redirect to Another Page After 5 Seconds Example




Hi Dev,

In this blog, I will show you how to redirect to another page in jquery after 5 seconds then i will give you simple example to redirect to url after 10 seconds, 15 seconds, 30 seconds or any specific time in jquery. we will use setTimeout() for redirect to url after 5 seconds in jquery.

In this example we will create one button to redirect another page after 5 seconds. when you click on that button, then button will say you "Redirecting soon....". After 5 seconds it will redirect to given url page.

You can see bellow full example that will help to redirecting to another page url in jquery.


<!DOCTYPE html>



<title>Jquery Redirect to Another Page After 5 Seconds Example - NiceSnippets.com</title>

<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>



<button>Click to redirect</button>

<script type="text/javascript">


$(this).text('Redirecting soon....');

var delay = 5000;

var url = 'https://itsolutionstuff.com'

setTimeout(function(){ window.location = url; }, delay);





It will help you....