為了滿足將網站加入到可信站點中,使用系統的控件,在彈出窗口的時候不用提示用戶。可以通過下面的方法實現:
首先,了解一下可以設置的值和含義。
可信站點的注冊表項目錄
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安全設置,禁用彈出窗口阻止程序就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持。