title: How to disable or customize the default message in alert showing to stop exist page without being saved
body: <p>I am working on react JS. I need either disable or customize the default message &quot;Changes you made may not saved&quot;. I have used the code shown below, but there is no change in default message. Can Someone help to solve the issue.</p>
  <p><em>Code used to customize the pop up message</em></p>
  <pre><code> useEffect(() =&gt; {
      return () =&gt; {
  
         window.addEventListener(&quot;beforeunload&quot;, function(e) {
         let confirmationMessage = &quot;'It looks like you have been editing something. &quot;;
         (e || window.event).returnValue = confirmationMessage; //Gecko + IE
       formRegistered &amp;&amp;   handleSubmit(e)
       console.log(&quot; confirmationMessage&quot;, confirmationMessage)
        return confirmationMessage; //Webkit, Safari, Chrome
      
      });
     }
     
    });
  
  </code></pre>
  <p><em>code used to disable the pop up</em></p>
  <pre><code> useEffect(() =&gt; {
      return () =&gt; {
  
         window.addEventListener(&quot;beforeunload&quot;, function(e) {
         let confirmationMessage = &quot;/o &quot;;
         (e || window.event).returnValue = confirmationMessage; //Gecko + IE
       formRegistered &amp;&amp;   handleSubmit(e)
       console.log(&quot; confirmationMessage&quot;, confirmationMessage)
        return null; //Webkit, Safari, Chrome
      
      });
     }
     
    });
  
  [![enter image description here][1]][1]
  
  
    [1]: https://i.stack.imgur.com/wWyjJ.png
  </code></pre>