是否有任何阻止在点击邮件链接时调用onbeforeunload被调用的问题。 在FF,Safari,IE它工作正常。防止onbeforeunload在点击邮件链接时被调用
<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>
Firefox怎么办? – Qwertiy 2016-03-21 13:24:07
@Qwertiy Firefox怎么样? OP说它在那里工作得很好。 – robertc 2016-03-21 14:55:50
单击FF中的mailto-link,flag设置为true,不会触发'onbeforeunload'事件。现在关闭页面:'onbeforeunload'被触发但被忽略。 – Qwertiy 2016-03-21 15:06:40