Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
Redirecting script on webpage with delay location.redirect not working javascript

This is in script tag in my base html

 const arraypathname = [`array of paths`]

 var i = 0; 

```
this function loops array of paths and should redirect on every path url from array  with delay
```

function redirectFunc(){
  setTimeout(function() {  
    var path_to_redirect = arraypathname[i];
    window.location.redirect(path_to_redirect);
    
        ```
this doesn work when i used alert() with path it work and every 3 sec i get alert with different path. Why windows.location.replace not working?
        ```
    i++;             
    if (i < 10) {         
      redirectFunc();      
    }                      
  }, 3000)
  
}

```
i have a base.html file witch is used on every page on my site and i want to do presentation script witch will loop through all paths on web with delay
```

i dont know why its not working like that when i used alert(path_to_redirect) every 3 seconds it alert me with url

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!