无论如何,在单击chrome中的mailto链接时,是否可以防止调用onbeforeunload。在 FF、Safari、IE 中运行良好。
<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:someone@somewhere.com?subject=test mail&body=Hello%20World">Mail Link</a>
</body>
</html>