Prevent onbeforeunload from being called when clicking on mailto link

Posted by Amit on Stack Overflow See other posts from Stack Overflow or by Amit
Published on 2009-11-17T13:54:04Z Indexed on 2011/02/21 15:25 UTC
Read the original article Hit count: 700

Filed under:
|

Is there anyway to prevent onbeforeunload from being called when clicking on mailto link in chrome. In FF, Safari, IE it is working fine.

<html>
<head>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
		google.load("jquery", "1.3.2");
	</script>

	<script type="text/javascript">
		$(document).ready(function(){
			window.onbeforeunload = confirmExit;
		});

		function confirmExit() {
			return "Are you sure?";
		}
	</script>
</head>
<body>
	<a href="mailto:[email protected]?subject=test mail&body=Hello%20World">Mail Link</a>
</body>
</html>

© Stack Overflow or respective owner

Related posts about mailto

Related posts about onbeforeunload