你知道吗?wb是默认开启兼容性视图的
前天晚上发现用webbrowse不能打开网页1.html,总是弹出并提示脚本错误(当前页面的脚本发生错误,脚本文件为:12.js),
但是用IE浏览器可以正常访问(360浏览器可用极速模式访问)
我尝试了以下几种方法:
1:我以为是webbrowse默认不支持运行activeX控件,查了很多资料,还是无法解决
2:我想用IE自带的浏览器控件,就是从COM+里面提取IE控件,结果还是一样报脚本错误
3:今天偶然发现用360浏览器的极速模式可以打开这个网页,后来我想IE浏览器是不是也有2种浏览模式:兼容模式和极速模式?
结果一查发现IE有2种模式:兼容模式和正常模式,webbrowser是默认开启兼容性视图的,所以才会导致有上面的脚本错误!
webbrowser调用的ie版本是和你机器上安装的版本保持一致,区别在于wb默认开启兼容性视图
解决方案:修改注册表:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
类似QQBrowse.exe, 你需要新增1项:数值的十进制改为8000即可
参考MSDN:
Value Key: yourapplication.exe
The value to set this key to is (taken from MSDN here) as decimal values:
9999 (0x270F)
Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.
9000 (0x2328)
Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.
8888 (0x22B8)
Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive.
8000 (0x1F40)
Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode.
7000 (0x1B58)
Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode.
相关文章:
http://blog.****.net/net_lover/article/details/24182287
http://tieba.baidu.com/p/3240720555
相关问