Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda