绕过 IE “您正在查看的网页..."弹出 [英] Bypass IE "The webpage you are viewing..." pop up

查看:37
本文介绍了绕过 IE “您正在查看的网页..."弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法绕过下面的IE弹出框:

Is there a way to bypass the following IE popup box:

您正在查看的网页正在尝试关闭窗口.你想要_____吗关闭这个窗口?是|否

The webapge you are viewing is trying to close the window. Do you want to close this window? Yes|No

当我将 window.close() 添加到 asp.net 按钮控件的 onclick 事件时会发生这种情况.

This is occurring when I add window.close() to the onclick event of an asp.net button control.

推荐答案

您的 JavaScript 代码只能在没有确认的情况下关闭先前由 window.open() 打开的窗口.这是一种有意的安全预防措施,因为在网页上运行的脚本并不拥有该窗口,并且通过关闭它会丢弃该窗口中的浏览历史记录.

Your JavaScript code can only close a window without confirmation that was previously opened by window.open(). This is an intentional security precaution because a script running on a webpage does not own the window, and by closing it discards the browsing history in that window.

解决方法是有一个欢迎页面"或其他某种页面,该页面首先弹出您要使用 window.open 关闭的窗口,或者告诉您的用户修改他们的浏览器安全设置以允许您的应用程序关闭其窗口.

The workaround is to either have a "welcome page" or otherwise some sort of page that pops up the window you want to close with window.open in the first place, or to tell your users to modify their browser security settings to allow your application to close their windows.

这篇关于绕过 IE “您正在查看的网页..."弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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