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

266
Vistas
Redirect History.back() to another path with JavaScript

Expected When the user is on the /animals route, when they click the back button on the browser i want to redirect them back to another route instead of the previous route.

What's actually happening:

I am trying to redirect the url when the user clicks the back button on the browser, however i am having trouble with this where it is replacing the current location when the page loads on that route instead of replacing it when the user clicks the back button and it removes the pathname on top of that.

    if (window.location.hash === '#/animals') {
        return history.pushState({}, '', '/home');
    }
about 4 years ago · Santiago Gelvez
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