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

169
Vistas
Using location.href on webpage is not saving the last page to history

So currently, I'm running this code on my webpage in order to detect where the user came from:

if (document.referrer == "https://firsturl.com/") {
  window.location.href = "https://secondurl.com/next"
} else if (document.referrer == "https://secondurl.com/") {
  location.replace("https://firsturl.com/specialpage")
}

but it isn't adding the first (original) page to history even though I am using location.href for the first redirect. Basically what I want the user to do is to click on a button, then click the back button, and then they'll be on a different page.

By the way, I would appreciate any solutions that don't require AJAX or JQuery.

about 4 years ago · Santiago Trujillo
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