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

141
Visualizações
How to disable or customize the default message in alert showing to stop exist page without being saved

I am working on react JS. I need either disable or customize the default message "Changes you made may not saved". I have used the code shown below, but there is no change in default message. Can Someone help to solve the issue.

Code used to customize the pop up message

 useEffect(() => {
    return () => {

       window.addEventListener("beforeunload", function(e) {
       let confirmationMessage = "'It looks like you have been editing something. ";
       (e || window.event).returnValue = confirmationMessage; //Gecko + IE
     formRegistered &&   handleSubmit(e)
     console.log(" confirmationMessage", confirmationMessage)
      return confirmationMessage; //Webkit, Safari, Chrome
    
    });
   }
   
  });

code used to disable the pop up

 useEffect(() => {
    return () => {

       window.addEventListener("beforeunload", function(e) {
       let confirmationMessage = "/o ";
       (e || window.event).returnValue = confirmationMessage; //Gecko + IE
     formRegistered &&   handleSubmit(e)
     console.log(" confirmationMessage", confirmationMessage)
      return null; //Webkit, Safari, Chrome
    
    });
   }
   
  });

[![enter image description here][1]][1]


  [1]: https://i.stack.imgur.com/wWyjJ.png
about 4 years ago · Juan Pablo Isaza
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