Jquery Redirect to URL After Specific Time Example

May 2, 2020 | Category : JQuery

In this post, we will learn how to redirect to another page in jquery after 5 seconds. you will learn jquery redirect to url after specific time. This article goes in detailed on load page after some time jquery. We will use jquery redirect to url after 5 seconds. follow bellow step for jquery redirect to url after 10 seconds.

In this example we will create one button to redirect another page after 2 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.

Example:

<!DOCTYPE html>

<html>

<head>

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

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

</head>

<body>

<button>Click to redirect</button>

<script type="text/javascript">

$("button").click(function(){

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

var delay = 2000;

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

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

})

</script>

</body>

</html>

I hope it can help you...