问题:在IE浏览器可以正常显示的网页,用WebBrowser打开,弹出 脚本错误窗口。
问题分析:WebBrowser用的虽然是IE内核,但是WebBrowser默认的IE版本(好像是IE7)和计算机当前的IE浏览器的版本不相同。
解决办法1:修改注册表,
Win7 32位,注册表位置: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
添加新项 "process.exe",(比如我的程序名是:process.exe), 右键,修改值, 选择“十进制” ,赋值 “9999”;
Win7 64位,注册表位置 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet
Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
添加新项 "process.exe",(比如我的程序名是:process.exe), 右键,修改值, 选择“十进制” ,赋值 “9999”;
【注】:关于赋值“9999”, 英文原版(只看的懂IE9,所以试了一个9999,然后我的问题解决了):
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.
本文将详细解释为何在使用WebBrowser打开网页时出现脚本错误窗口,并提供通过修改注册表来解决此问题的方法。通过设定特定的注册表键值,可以确保WebBrowser使用的IE版本与当前计算机的IE版本保持一致,从而避免脚本错误。适用于Windows 7 32位和64位系统。
2032

被折叠的 条评论
为什么被折叠?



