下面的脚本将我的站点添加到我的用户的受信任站点区域,以便能够运行 activeX 控件。
它在我的本地主机上完美运行,并且 URL 已添加到受信任的站点区域。但它没有做任何事情,并且在将包含脚本的网页复制到在线生产网站时确实出现了最后一条消息。我在这里做错了什么?
有人可以帮助我或建议另一种方法来完成相同的任务吗?
谢谢
<script type="text/vbscript">
On Error Resume Next
Sub addkey
Dim DomainArray, strComputer, strHTTP, strHTTPS
Dim dwordZone, regPath, objReg, counter, subkeyPath, icounter
Dim subkeyValue
Const HKEY_CURRENT_USER = &H80000001
DomainArray = "mydomain.ca"
strComputer = "."
strHTTP = "http"
strHTTPS = "https"
dwordZone = "2"
regPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" &_
"\ZoneMap\Domains\"
'Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}\\" & strComputer & "\root\default:StdRegProv")
subkeyPath = regPath & DomainArray
objReg.CreateKey HKEY_CURRENT_USER,subkeyPath
regPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" &_
"\ZoneMap\Domains\mydomain.ca\"
subkeyPath = regPath & "www"
objReg.CreateKey HKEY_CURRENT_USER,subkeyPath
objReg.SetDWORDValue HKEY_CURRENT_USER,subkeyPath,strHTTPS,dwordZone
MsgBox("https://www.mydomain.ca has been added to the Trusted Sites Zone.")
objReg.DeleteValue HKEY_CURRENT_USER, subkeyPath, strHTTPEnd Sub
</script>