如何防止IE11弹出(你确定要离开这个页面) [英] How to prevent IE11 pop up (Are you sure you want to leave this page)

查看:582
本文介绍了如何防止IE11弹出(你确定要离开这个页面)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个页面,我没有任何要输入的内容,只有一个下拉列表可供选择,但在IE11中,当我尝试继续下一页时,它会弹出消息。我想防止这种弹出发生。所以我只是想知道IE11中弹出的默认行为是什么(因为它没有出现在Chrome或Firefox中)以及如何阻止弹出

I am working on a page that I have nothing to type but a dropdown to select, but in IE11 when I try to move on to the next page, it will pop up the message. I would like to prevent this pop up from happening. So I just wonder what is the default behavior of that pop up in IE11(As it does not appear in either Chrome or Firefox) and how to prevent the pop up

推荐答案

要问的一个更重要的问题是:为什么IE11会弹出那个警报?。

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

你是否正在离开安全页面一个不安全的人?即确保通过未明确指定协议来调用安全预订API或让浏览器选择:

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.

如果你只是想摆脱弹出窗口,假设你提到的弹出窗口是一个警告框,你可以覆盖 alert

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; }

这篇关于如何防止IE11弹出(你确定要离开这个页面)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆