How to prevent IE11 pop up (Are you sure you want to leave this page)

僤鯓⒐⒋嵵緔 提交于 2019-12-05 08:45:20

A more important question to ask is: "Why IE11 is popping up that alert?".

Are you leaving a secure page for an insecure one? I.e. make sure to call the secure booking API, or let the browser choose, by not explicitly specifying the protocol:

var url = '//api.booking_site.url/api_endpoint';

This will call either the secure or insecure version of the url depending if you're currently browsing a secure or insecure site.

If you just want to get rid of the pop-up, assuming the pop-up you mention is an alert box, you can overwrite alert:

window.alert = function() { return true; }
Nils

This looks like it's a result of the return value from onbeforeunload. Apparently, instead of returning null you should return nothing.

See also onBeforeUnload handler says null in IE

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!