我一直试图让这个退出流行音起作用。到目前为止,我可以在FF,Chrome和Safari的Mac上使用它,但在IE,FF,Chrome for Windows上苦苦挣扎。这是我到目前为止尝试过的两个片段:
<script language=javascript>
function thankYou(){
var win=window.open("[url.com]", "_blank", "left=20,top=20,width=500,height=500,scrollbars=1"); win.focus(); }
</script>
<body onUnload="thankYou()">
和
<SCRIPT>
function thankYou() {
var ConfirmStatus = confirm("We would love to receive your feedback on your experience of this page. Would you like to complete our short survey?");
if (ConfirmStatus == true) {
window.open("[url]", "win", "left=20,top=20,width=500,height=500,scrollbars=1");
} else {
window.close();
}
}
window.onunload=thankYou;
</SCRIPT>
不确定如何在Windows上运行它。提前谢谢!
答案 0 :(得分:1)
变化:
<body onUnload="thankYou()">
为:
<body onBeforeUnload="thankYou()">
和....
变化:
window.onunload=thankYou;
为:
window.onbeforeunload=thankYou;