Hari B

Hari B

  • NA
  • 139
  • 67.9k

Are you want leave this page Popup Message

May 27 2015 8:54 AM

Here I have one web page like create. suddenly if i click on other tab need to show warining message like are sure want to leave

this is my code:

 
 
<script type="text/javascript" language="javascript">
window.addEventListener("beforeunload", function (e) {
var confirmationMessage = 'It looks like you have been editing something.';
confirmationMessage += 'If you leave before saving, your changes will be lost.';
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});</script>

But my problem if i fill all fields and submit button i got Popup message like  you want to leave this page for above code. i Need to get warning message only if i click other page or other tab

Please help...

Thanks in advance


Answers (2)