security - Programmatically adding a Site to Internet Explorerâs Trusted Sites Zone? -
the script below adds site trusted sites zone users able run activex control.
it works perfect on localhost , url added trusted sites zone. doesn't , last message appear when copying webpage containing script online production website. doing wrong here?
can me or suggest way achieve same task?
thanks
<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 trusted sites zone.") objreg.deletevalue hkey_current_user, subkeypath, strhttpend sub </script>
you can't normal web page. enormous security disaster if random web pages diddle registry. whole point of trusted sites zone user has explicitly state trust site enough put there.
so reasonable approach getting site in trusted sites zone ask user manually add it. however, still inappropriate , unnecessary run activex control. trying activex control?
Comments
Post a Comment