简体   繁体   中英

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.

Does IE have an equivalent to the Firefox configuration option 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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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