我正在使用以下代码片段在页面关闭前触发警报,但Chrome似乎忽略了该消息并显示其默认消息“您是否想离开本网站?您所做的更改可能未保存”。我如何使chrome显示我的消息而不是默认的消息?页面关闭前的提醒:如何更改Chrome的默认消息?
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?";
}
定制的消息显示在铬50 – guest271314
它浏览器之间变化厂商是否允许自定义消息或没有。如果他们不这样做,你不能做任何事情 – charlietfl