I have a simple html form with few fields in it.
I wanted to make sure that user gets an alert message when he is trying to leave the page. So I added the script on the page which will run whenever user is trying to navigate away from this page.
But I am also getting this alert message when user is trying to submit the form. I dont want this alert message when user is saving the form.
Please help.
Below is some sample code.
<html>
<head>
<script>
function verifyexit() { return 'Are you sure ?'; } window.onbeforeunload = verifyexit;
</script>
</head>
<body>
Go to <a href="b.html"> another page </a>
<form action="c.html">
name : <input type="text" name="name" value=""/> <br>
email : <input type="text" name="email" value=""/> <br>
<input type="submit" value="save"/>
</form>
</body>