解除IE拦截弹出窗口限制,禁用关闭弹出窗口时的确认对话框。

从一个OA系统上看到的方法,记录在此:

1.把下面的文件保存成IE.reg,双击导入注册表

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\New Windows]
"PopupMgr"="no"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0]
"1609"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1]
"1609"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2]
"1609"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3]
"1609"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4]
"1609"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range1]
"http"=dword:00000002
":Range"="172.18.0.8"
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\New Windows\Allow]
"172.18.0.8=hex:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_WINDOW_RESTRICTIONS]
"iexplore.exe"=dword:00000000
"explorer.exe"=dword:00000000

注意把“172.18.0.8”这个地址改成实际的IP地址。

2.如果是IE7以上系统还需要修改下默认设置

        IE7及以上版本对于弹出窗口的打开方式,Internet设置中的常规 --> 选项卡 设置 --> 遇到弹出窗口时: 建议您勾选由IE决定如何打开弹出窗口。
3.在网站根目录下放一个closeIE7.htm文件,内容是:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>A8</title>
</head>
<body>
<script language="JavaScript">window.close();</script>
</body>
</html>

4.在弹出窗口页,比如登陆页加入如下脚步

function closeIt() {
            var nAppName = navigator.appName;
            var nAppVersion = navigator.appVersion;

            if (nAppName == "Netscape") {
                nVersionNum = nAppVersion.substring(0, 2);
            }
            else {
                var startPoint = nAppVersion.indexOf("MSIE ") + 5;
                nVersionNum = nAppVersion.substring(startPoint, startPoint + 3);
            }

            try {
                if (nVersionNum >= 7) {
                    window.open("closeIE7.htm", "_self");
                }
                else if (nVersionNum > 5.5) {
                    window.opener = null;
                    window.close();
                }
                else {//IE5.5以下的
                    document.write("<object classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11 id=closes><param name=Command value=Close></object>");
                    closes.Click();
                }
            }
            catch (e) {
            }
        }


5.在弹出窗口的函数里调用

  function winopen(targeturl) {
            var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
         
            if (isMSIE) {
                var newwin = window.open('', '', 'resizable=true,status=no');
                try {
                    newwin.focus();
                }
                catch (e) {
                    alert("您打开了窗口拦截的功能,请先关闭该功能。");
                    self.history.back();
                    return;
                }

                if (newwin != null && document.all) {
                    newwin.moveTo(0, 0);
                    newwin.resizeTo(screen.width, screen.height - 25);
                }

                newwin.location = targeturl;
                closeIt();//=============================================================这里调用
            }
            else {
                window.open(targeturl, '', 'height=' + window.screen.height + ', width=' + window.screen.width + ', top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
                window.close();
            }
        }

 通过注册表来修改IE安全设置,详见:http://blog.csdn.net/huanshanv20008/article/details/5676323

原文地址:https://www.cnblogs.com/zhaobl/p/2960722.html