博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
为WebBrowser指定IE内核版本(MSIE 7.0)
阅读量:5239 次
发布时间:2019-06-14

本文共 2751 字,大约阅读时间需要 9 分钟。

.Web Browser Control – Specifying the IE Version

I use the Internet Explorer Web Browser Control in a lot of my applications to display document type layout. HTML happens to be one of the most common document formats and displaying data in this format – even in desktop applications, is often way easier than using normal desktop technologies.

One issue the Web Browser Control has that it’s perpetually stuck in IE 7 (MSIE 7.0) rendering mode by default. Even though IE 8 and now 9 have significantly upgraded the IE rendering engine to be more CSS and HTML compliant by default the Web Browser control will have none of it. IE 9 in particular – with its much improved CSS support and basic HTML 5 support is a big improvement and even though the IE control uses some of IE’s internal rendering technology it’s still stuck in the old IE 7 (MSIE 7.0) rendering by default.

This applies whether you’re using the Web Browser control in a WPF application, a WinForms app, a FoxPro or VB classic application using the ActiveX control. Behind the scenes all these UI platforms use the COM interfaces and so you’re stuck by those same rules.

Feature Delegation via Registry Hacks

Fortunately starting with Internet Explore 8 and later there’s a fix for this problem via a registry setting. You can specify a registry key to specify which rendering mode and version of IE should be used by that application. These are not global mind you – they have to be enabled for each application individually.

There are two different sets of keys for 32 bit and 64 bit applications.

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

 

32 bit:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

Value Key: yourapplication.exe

64 bit:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

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.

转载于:https://www.cnblogs.com/emanlee/p/4298740.html

你可能感兴趣的文章
Gradle 语法
查看>>
Ureal Engine 4中getWorldLocation在Physics Constraint中的表现
查看>>
深入浅出JSONP:解决AJAX跨域问题
查看>>
oracle中去掉文本中的换行符、回车符、制表符
查看>>
实在自动现在APK,微信跳浏览器下载
查看>>
java之static关键字
查看>>
Linux系统下python代码运行shell命令的方法
查看>>
剑指offer——python【第38题】二叉树的深度
查看>>
Log4Net日志组件使用
查看>>
Windows 10 使用压缩包安装MySQL8.0.12
查看>>
bzoj 1689: [Usaco2005 Open] Muddy roads 泥泞的路
查看>>
Android 代码库(自定义一套 Dialog通用提示框 )
查看>>
[Java]ArrayList、LinkedList、Vector、Stack的比较
查看>>
我为什么要写博客,写博客给我带来了什么?
查看>>
Furure的简单介绍和使用
查看>>
jsp 监听器
查看>>
Libre 6005 「网络流 24 题」最长递增子序列 / Luogu 2766 最长递增子序列问题(网络流,最大流)...
查看>>
软件工程概论-作业之二
查看>>
豆瓣酱alpha版本发布了
查看>>
使用JavaMail发送邮件
查看>>