简体   繁体   English

禁止关闭IE中的JavaScript窗口

[英]Disallow JavaScript from closing window in IE

I'm trying to debug an issue where the browser disappears after refreshing a particular page. 我正在尝试调试刷新特定页面后浏览器消失的问题。 I want to see if I can eliminate JavaScript as being the cause of this issue. 我想看看是否可以消除JavaScript从而导致此问题。

Does IE have an equivalent to the Firefox configuration option dom.allow_scripts_to_close_windows ? IE是否具有等效于Firefox的配置选项dom.allow_scripts_to_close_windows

I did some googling and this was the closest thing I could find, but I do not know if it also prevents JavaScript from closing windows. 我做了一些谷歌搜索,这是我能找到的最接近的东西,但是我不知道它是否还会阻止JavaScript关闭窗口。

Prevent Users from Closing the Browser or Explorer Windows 防止用户关闭浏览器或资源管理器窗口

Edit: You can use the onbeforeunload event to see if the page is triggering some sort of close event. 编辑:您可以使用onbeforeunload事件来查看页面是否正在触发某种关闭事件。

window.onbeforeunload = function() {
  return "The browser is about to close this window, are you sure?"; // Will appear as a confirmation box
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM