为了满足将网站加入到可信站点中,使用系统的控件,在弹出窗口的时候不用提示用户。可以通过下面的方法实现:
首先,了解一下可以设置的值和含义。
可信站点的注册表项目录
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range[*]
ActiveX控件的注册表项目录
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\[0-4]\[*]
含义说明:
ActiveX 控件设置值的含义:3为禁用,0为启用,1为提示
注册表项中目录 [0-4] 的含义
注册表项中 [*] 的含义
弹出窗口阻止程序的注册表项
HKEY_CURRENT_USERHKCU\Software\Microsoft\Internet Explorer\New Windows\PopupMgr
具体脚本如下:
<SCRIPT LANGUAGE="JavaScript"> <!-- var WshShell=new ActiveXObject("WScript.Shell"); //添加可信站点或IP WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range100\\",""); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range100\\http","2","REG_DWORD"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range100\\:Range","www.jb51.net"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range101\\",""); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range101\\http","2","REG_DWORD"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range101\\:Range","www.example.com"); //修改IE ActiveX 安全设置 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3\\1001","0","REG_DWORD"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3\\1004","0","REG_DWORD"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3\\1200","0","REG_DWORD"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3\\1201","0","REG_DWORD"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3\\1405","0","REG_DWORD"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3\\2201","0","REG_DWORD"); //禁用弹出窗口阻止程序 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\New Windows\\PopupMgr","no"); alert("可信站点设置,ActiveX 控件安全设置,弹出窗口设置成功"); //--> </SCRIPT>
比如把 www.jb51.net 添加到客户的可信站点
1. 打开注册表(运行regedit),首先依次打开以下的目录
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains
2. 在目录下新建一个项:“jb51.net”
3. 在 jb51.net 下面再新建一个项:“www”
4. 在 www 下新键一个双字节子键:“*”(表示任何协议,或者设置为:“http”、“ftp”等单个协议)
5. 双击刚才新建的双字节子键“*”,确保基数里选择是“十六进制”,在数值数据种填写“2(表示可信站点)”
6. 关闭注册表
<SCRIPT LANGUAGE="JavaScript"> <!-- var WshShell=new ActiveXObject("WScript.Shell"); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\jb51.net",""); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\jb51.net\\www",""); WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\jb51.net\\www\\http","2","REG_DWORD" ); alert("成功将jb51.net写入到可信站点"); //--> </SCRIPT>
以上这篇js实现添加可信站点、修改activex安全设置,禁用弹出窗口阻止程序就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。