这SB一样的对话框,是自IE8开始出现的,虽然可以通过Internet选项修改为允许,但是如果用程序修改就无从下手了
Google了下【C# Change Internet Explorer settings】,运气很好,第一个就是,通过注册表可以修改
以下是原文:
Any idea how do I do the following using C#?
- Going to
Tools -> Internet Options -> Security
- Select the
Security
tab - Click the
Custom Level
button - In the
Miscellaneous
section changeDisplay mixed content
toEnable
The “cheat” way to do this is to change the value
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0\1609
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1\1609
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2\1609
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\1609
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4\1609
Where 0-4 are Zone identifiers and the value is 0 to Allow, 1 to Prompt, and 3 to Block. Keep in mind that if your code does this on anyone’s machine but your own, you’re likely to find your code blocked as malware.
The “proper” way to do this is to use the APIs to create an IInternetZoneManager and callSetZoneActionPolicy to adjust the settings for URLACTION_HTML_MIXED_CONTENT in the zones you want to adjust.
很好,看起来这个对话框可以干掉了,只需要在程序运行时修改就可以了,但是要注意,一定要在WebBrowser控件初始化前改变,否则等下次生效吧!
什么时候写完代码,再更新C#操作注册表调整Internet选项~哈哈