我一直在尝试使此退出弹出窗口起作用。到目前为止,我可以在FF,Chrome和Safari的Mac上运行它,但在Windows的IE,FF和Chrome上却遇到了麻烦。到目前为止,我尝试了以下两个片段:

<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上运行。提前致谢!

最佳答案

更改:

<body onUnload="thankYou()">


至:

<body onBeforeUnload="thankYou()">


和....

更改:

window.onunload=thankYou;


至:

window.onbeforeunload=thankYou;

09-18 20:03