当前位置: 代码迷 >> JavaScript >> win7上js怎么修改注册表添加信任站点
  详细解决方案

win7上js怎么修改注册表添加信任站点

热度:79   发布时间:2012-07-31 12:33:47.0
win7下js如何修改注册表添加信任站点
我做了如下操作,但是发现在win7执行无效,XP的可以:
JScript code

<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.XXX.com");
 //修改IE ActiveX 安全设置
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2\\1001","0","REG_DWORD");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2\\1004","0","REG_DWORD");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2\\1200","0","REG_DWORD");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2\\1201","0","REG_DWORD");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2\\1405","0","REG_DWORD");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2\\2201","0","REG_DWORD");
 //禁用弹出窗口阻止程序
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\New Windows\\PopupMgr","no");
 alert("可信站点设置,ActiveX 控件安全设置,弹出窗口设置成功");
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
<
 var WshShell=new ActiveXObject("WScript.Shell");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\XXX.com","");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\XXX.com\\www","");
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\XXX.com\\www\\http","2","REG_DWORD"
 );
 //禁用弹出窗口阻止程序
 WshShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\New Windows\\PopupMgr","no");
 alert("成功将XXX.com写入到可信站点");
</SCRIPT>



如上代码在xp下执行的话,会把www.XXX.com加入到信任站点,但是在win7下则完全没效果,而且连alert弹对话框都不弹,是不因为权限不够执行失败了它不往下执行的原因?

请教下具体该怎么处理呢?希望弄过的大哥大告知下,感激不尽。。。。

------解决方案--------------------
我来了,谢谢楼主发善心
  相关解决方案