JS中实现自动添加一个可信任站点问题?

时间:2022-04-03 14:26:10
我想实现当客户端在首页点击一个按钮时,能够自动将本站添加为可信任站点,我在网上搜了如下一段代码,功能是可以实现(点击按钮后提示不安全是否交互,点确定添加可信任站点),但是问题是每次客户进入那个首页的时候都会提示“在此页上的ActiveX控件和本页上的其他部分交互可能不安全,你想允许这种交互吗?”,怎样才能达到当客户点击按钮的时候添加,不点击的时候就默认他是已经添加过了呢??头疼,大哥们帮忙解决下。

<html>
<head>
<script>
var WshShell=new ActiveXObject("WScript.Shell");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net\\www","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net\\www\\http","2","REG_DWORD");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\http","2","REG_DWORD");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\:Range","192.168.1.1");
</script>
<title>ss</title>
</head>
<body>
dddd
</body>
</html>



5 个解决方案

#1


<html>
<head>
<script>
function addsite(){
var WshShell=new ActiveXObject("WScript.Shell");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net\\www","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net\\www\\http","2","REG_DWORD");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\http","2","REG_DWORD");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\:Range","192.168.1.1");
}
</script>
<title>ss</title>
</head>
<body>
<input type="button" value="添加为可信任站点" onclick="addsite()" />
dddd
</body>
</html>


这样可以么?

#2


浏览器安全限制!

#3


楼主太缺乏常识了吧。浏览器安全懂吗?让你这样随便乱来还了得吗?

#4


3楼的亮了

#5


在IE浏览器的受信任的站点里自定义极别启用[对未标记为安全可执行脚本的activex初始化]

#1


<html>
<head>
<script>
function addsite(){
var WshShell=new ActiveXObject("WScript.Shell");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net\\www","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains\\china.net\\www\\http","2","REG_DWORD");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\","");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\http","2","REG_DWORD");
WshShell.RegWrite("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Ranges\\Range1\\:Range","192.168.1.1");
}
</script>
<title>ss</title>
</head>
<body>
<input type="button" value="添加为可信任站点" onclick="addsite()" />
dddd
</body>
</html>


这样可以么?

#2


浏览器安全限制!

#3


楼主太缺乏常识了吧。浏览器安全懂吗?让你这样随便乱来还了得吗?

#4


3楼的亮了

#5


在IE浏览器的受信任的站点里自定义极别启用[对未标记为安全可执行脚本的activex初始化]