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

180
Visualizações
How to stay on the Current Page in JavaScript after refresh

guys!

I am working on a project with Java + Javascript and when I refresh the page instead of staying in my home page, it's redirecting to login page.

I'm new to this and want to know how can I stay on same page after refreshing. I read some examples but it's not clear how to achieve this.

Example: if I'm in Settings page and press F5 or reloa, I wanna stay in Settings Page.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

.preventDefault can be used on event listeners to avoid refreshing The event listener can be anything that causes the refresh

about 4 years ago · Juan Pablo Isaza Relatório

0

Typically location.reload(); would be used to refresh to the same URL, but your application logic might only allow access to particular URLs after going through certain other steps - e.g. logging in.

Without more information, your question will be almost impossible to answer.

You should try to figure out the steps that your application goes through during a bootstrap (i.e. start-up), as refreshing in a web app is effectively a restart of the JavaScript application.

about 4 years ago · Juan Pablo Isaza Relatório
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