javascript IE 停止消息“您正在查看的网页正在尝试关闭选项卡..”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17300705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 07:47:37  来源:igfitidea点击:

IE stop message “the web page you are viewing is trying to close the tab.."

javascriptinternet-explorertabs

提问by user2132017

I have a script on page that will close the web page but when it does that I am getting this pop up message “the web page you are viewing is trying to close the tab. Do you want to close this tab?”

我在页面上有一个脚本可以关闭网页,但是当它关​​闭时,我收到此弹出消息“您正在查看的网页正在尝试关闭该选项卡。您要关闭此选项卡吗?”

I want to suppress this message. I am using IE and done following settings In IE Tools/Internet Options/Security/(select) Internet Zone> (click) Default Level.

我想取消此消息。我正在使用 IE 并在 IE 工具/Internet 选项/安全/(选择)Internet 区域>(单击)默认级别中完成以下设置。

Or, Internet Options>/Security> (select) Internet Zone> Custom> Scripting> Active scripting> Enable. Both the settings didn't worked for me and I am still getting the message. How can I prevent this?

或者,Internet 选项>/安全>(选择)Internet 区域>自定义>脚本>活动脚本>启用。这两个设置对我都不起作用,我仍然收到消息。我怎样才能防止这种情况?

回答by Arjen van Heck

The webpage you are viewing is trying to close this window warning in Internet Explorer

您正在查看的网页正在尝试关闭 Internet Explorer 中的此窗口警告

This is a old question and in the awnsers also lays your awnser i quote:

这是一个老问题,在 awnsers 中也列出了我引用的 awnser:

"Javascript can close a window if a javascript code opens it."

“如果 javascript 代码打开一个窗口,Javascript 可以关闭它。”

Otherwise, it can't. It is just a security feature. I hope i helped :)

否则,不能。这只是一个安全功能。我希望我有所帮助:)

回答by Nicolas

There are some interesting workarounds on this question, basically revolving around inserting a window.open()somewhere into the sequence.

这个问题有一些有趣的解决方法,基本上围绕在window.open()序列中插入一个地方。

Bypass IE "The webpage you are viewing..." pop up

绕过 IE 弹出“您正在查看的网页...”