Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda