0

I have this code to redirect to another site. I'm wondering if someone can help me building a 5s delay into this?

jQuery(document).ready(function($){ 
    $(location).attr("href","www.example.com") 
});

Cheers!

Lelio Faieta
  • 6,242
  • 6
  • 38
  • 64
Mark
  • 3
  • 1
  • Use a `setTimeout()`. However I'm a little confused as this is just updating the attribute of an element, it doesn't actually redirect the page at all. – Rory McCrossan Jan 17 '20 at 10:42
  • http://www.jqueryfaqs.com/Articles/Redirect-to-another-page-after-delay-5-seconds-some-seconds-using-jQuery.aspx – Arvind Maurya Jan 17 '20 at 10:42

1 Answers1

0
  setTimeout(function(){
         $(location).attr("href","www.example.com");
   }, 5000);

more detail could be find at below link Check the link

Akhil Aravind
  • 5,388
  • 15
  • 34
sampath
  • 604
  • 1
  • 10
  • 30