Redirect To Another Page After 5 Seconds?

we will learn redirect in javascript, If you are looking for how to redirect to another page in jquery after 5 seconds then I will give you a simple example to redirect to URL after 2 seconds, 3 seconds, 5 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 2 seconds. when you click on the button, then the button will say to you "Redirecting soon....". After 5 seconds it will redirect to the given URL page.

Redirect To Another Page After 5 Seconds? - Step By Step

You can see bellow a full example will help to redirect to another page URL in jquery.

Example 1:
<!DOCTYPE html>
    <title>Redirect to Another Page After 5 Seconds - Php Coding Stuff</title>
    <script src="" crossorigin="anonymous"></script>
<button>Click to redirect</button>
<script type="text/javascript">
        $(this).text('Redirecting After 2 Seconds................');
        var delay = 2000; 
        var url = ''
        setTimeout(function(){ window.location = url; }, delay);

I hope it can help you...

Leave a Reply

Your privacy will not be published. Required fields are marked *

We'll share your Website Only Trusted.!!