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

137
Visualizações
Detection of reload button pressed in Java Script

How to detect whether the reload button is pressed and after that the the processes be held and after that reload. Like when reload is pressed or Ctrl + R then I want to save that it is reloaded in local storage.

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

0

The event handler for processing onbeforeunload events is the WindowEventHandlers mixin's onbeforeunload property. When a window is about to unload its resources, these events are triggered.

window.onbeforeunload = function(m) {
  return 'Your Statement';
};

And you can refer to Mozilla docs for more because you didn't shared your source code. https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload

about 4 years ago · Juan Pablo Isaza Relatório

0

To save localStorage in browser on reload/refresh of page.

Add Javascript code as below

window.onload = function () {
    alert(localStorage.variable) //comment this line to avoid alert box
    localStorage.setItem("variable", "set a variable value");
}
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