我使用下面的方法检查浏览器点击它应该显示警告信息的按钮但是这里没有显示关闭时的警告信息???
function closing() {
var answer = confirm("Do you wnat to close this window ?");
if (answer){
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');
window.close();
}
else{
stop;
}
}
答案 0 :(得分:1)
试试这个:
window.onbeforeunload = function()
{
return "Already leaving?";
}
https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload