Is there a way to use JQuery to redirect to a specific URL after a give time period?
To redirect a webpage after 5 seconds, use the setInterval() method to set the time interval. Add the webpage in window. location. href object.
By using HTML Anchor Tags <a>.. </a>, you can Redirect on a SIngle Button Click [html button click redirect]. To use HTML Anchor tags to redirect your User to Another page, you need to write your HTML Button between these HTML Anchor Tag's starting <a> and Closing </a> Tags.
You could use the setTimeout()
function:
// Your delay in milliseconds var delay = 1000; setTimeout(function(){ window.location = URL; }, delay);
You don't really need jQuery for this. You could do it with plain javascript using the setTimeout method:
// redirect to google after 5 seconds window.setTimeout(function() { window.location.href = 'http://www.google.com'; }, 5000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With