chrome浏览器51之前的版本,允许页面离开的时候让开发者弹出自定义的提示信息,51版本(包括51)不允许弹出自定义的窗口。
window.onbeforeunload = function(e) {
e.returnValue = "A search is in progress, do you really want to stop the search and close the tab?";
return "A search is in progress, do you really want to stop the search and close the tab?";
}//无效
网友评论