青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

牽著老婆滿街逛

嚴以律己,寬以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

WebBrowser與IE的關系,如何設置WebBrowser工作在IE9模式下?

轉載自:http://www.cnblogs.com/liuzhendong/archive/2012/03/21/2410107.html

一.問題的提出


偶然發現,Winform里的WebBrowser和IE實際安裝的版本似乎并不同步,很有趣!

 

下面有張圖,里面一個窗口是用IE9打開某網站,另一個窗口是用Winform+WebBrowser打開同樣的網站,有意思的事情出現了。

 

在IE9窗口中,這個網站左邊菜單樹無法顯示,原因是IE9使用的技術較新,而網站使用的技術較舊,未能及時同步更新到支持IE9所致。該如何辦呢?

微軟在IE9中提供一個兼容性視圖功能,只要一點擊兼容性視圖就可以兼容舊版本瀏覽器的網站。
 


引用MSDN “To overcome potential compatibility issues, Internet Explorer supports a feature called Compatibility View that allows users to display troublesome pages in IE7 mode. “ URL: http://msdn.microsoft.com/en-us/library/dd567845(v=VS.85).aspx

也就是說,這個兼容模式就是IE7的模式。

 

又查了些ms資料,發現這個兼容性視圖在IE8時首次引入,在IE9,IE10中都將繼續支持。

 

再翻回來看Winform+WebBrowser這個窗口,它打開同樣的網站卻能顯示左邊菜單樹,這樣看來,似乎WebBrowser不用設置就默認自動打開了兼容性視圖模式。

 

現在就去仔細查一下權威資料,核實一下兩個問題:
1.Webbrowser與IE到底是什么關系?是否確實用ie內核, 是否本質上和360安全瀏覽器,傲游瀏覽器和騰訊TT等IE內核瀏覽器相同。
2.Webbrowser是否使用兼容瀏覽模式,以及這個模式是否能改?

 

二.查詢結果

1.webbrowser調用的就是本機IE9,并且webbrowser默認就是運行在IE7 mode下,除非你改變它.

發現一個msdn的帖子,明確表示webbrowser調用的就是本機IE9,并且webbrowser默認就是運行在IE7 mode下,除非你改變它。
How to make c# WebBrowser equivalent to IE browser  
http://social.msdn.microsoft.com/Forums/en/winforms/thread/2ed65b9d-c601-4ca8-bde1-64584fc87515

摘幾句:
Wow first post with such bold claim without any source backing up. You probably should read the IE SDK (the manual you need to read if you want to use the webbrowser control) or dig through the IE programming forums (that's the place others often go when they are stuck on IE programming) if you want to use the webbrowser control.

Webbrowser is a wrapper around IE APIs. There is no such thing as multiple versions of IE coexisting on the same computer. You will always get the one and only version of IE installed on the computer from webbrowser control.

There are many, many documented setting differences between default IE and webbrowser. Basically you don't have to opt out new features in webbrowser that may break your app (the Visual Studio team learned a hard lesson here, when IE8 breaks Visual Studio's wizards) , you have to write code to opt in, unless the improvement is security related. That means the webbrowser will run in IE7 mode unless you change the mode in feature control.

Note some web site declare their requirement of IE7 or IE8 mode. It may not be wise to force the IE9 mode. 

 

2.微軟新聞組的一個帖子,Webbrowser Control without IE,里面明確提到,不裝IE,無法用webbrowser.
http://groups.google.com/group/microsoft.public.vb.controls/browse_thread/thread/7575bd25e0730ded/aa40f3dfc799407d?lnk=gst&q=WebBrowser+ie#aa40f3dfc799407d

IE must be installed on the machine for you to use Webbrowser Control.

Internet Explorer MUST be installed to use the WebBrowser control.  There are simply no ifs, ands, or buts about it.  How can you expect to use IE functionality if IE is not installed?

 

3.如何設置WebBrowser在IE9 mode下工作呢?
答曰:需要修改注冊表,具體看下面4,5,6,尤其6最全面,可以光看6。

 

4.WPF webbrowser control using IE7 instead of IE9
http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/4431908e-1869-4435-bcea-a3ec0820edfb

摘抄幾句:
How do I make it so the WPF WebBrowser control will use IE9 as the browser engine instead of IE7?
I have some HTML that is rendering differently in the WebBrowser control than in the IE9 browser. When I run the following javascript in the WebBrowser, the result is "7". as in IE7.

I found an article by Rick Strahl that describes registry settings that will get the WebBrowser to use IE9. But I would like to avoid that. And I am interested to know how IE7 comes about being used.http://www.west-wind.com/weblog/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
回答:You want to avoid the only documented way to set document compatibility mode for webbrowser hosts? Why?

 

5.WebBrowser and CSS3 ?
http://social.msdn.microsoft.com/Forums/en-AU/winforms/thread/1b656af7-bda9-47d9-8f9a-1d886d3688ca
Web browser control by default runs in compatibility mode unless you set the feature browser emulation registry key. The fact that IE9 is able to render CSS3 correctly and browser control is not seems to suggest browser control is not running in IE9 standards mode.

You'll need to set Browser emulation feature key (FEATURE_BROWSER_EMULATION) described at this link http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx

You can use 9000 value, unless you want to force IE 9 standards mode for all pages. In case of later, you need to use 9999.

hklm

If hklm and 64bit machine used, you need to check is Wow6432Node needs to be changed.

And finally you need to add process name hosting browser control as value name in the registry key.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"prevhost.exe"=dword:00001f40
"sllauncher.exe"=dword:00001f40
"WindowsFormsApplication1.exe"=dword:0000270f

 

6.Web Browser Control – Specifying the IE Version 
http://www.west-wind.com/weblog/posts/2011/May/21/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 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 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.

32 bit:

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

Value Key: yourapplication.exe

64 bit:

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.

 

ok, 言盡至此,無話可說了!

作者:BobLiu 
郵箱:lzd_ren@hotmail.com
出處:http://www.cnblogs.com/liuzhendong
本文版權歸作者所有,歡迎轉載,未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。

posted on 2015-05-18 14:50 楊粼波 閱讀(1352) 評論(1)  編輯 收藏 引用

評論

# re: WebBrowser與IE的關系,如何設置WebBrowser工作在IE9模式下? 2015-05-18 14:51 楊粼波

如果IE是6 7,那么控件就使用相應的版本。

如果IE是 8 9 ,控件默認 是7,除非改注冊表,或者在html里面加入:
<meta http-equiv="X-UA-Compatible" content="IE=11" />

用了這么久這個控件,才知道原來是這么一回事。  回復  更多評論   


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲午夜久久久久久尤物| 好吊色欧美一区二区三区四区| 久久亚洲精品视频| 美女国内精品自产拍在线播放| 欧美xart系列高清| 欧美日韩精品在线| 国产免费成人| 激情视频亚洲| 亚洲一区二区伦理| 狂野欧美激情性xxxx欧美| 欧美国产精品v| 中文国产亚洲喷潮| 久久综合网络一区二区| 国产精品网站一区| 99精品国产在热久久| 欧美中文在线字幕| 亚洲乱码精品一二三四区日韩在线| 一区二区欧美精品| 免费视频一区二区三区在线观看| 国产精品国产福利国产秒拍| 伊人久久成人| 午夜精品福利在线| 亚洲日韩中文字幕在线播放| 亚洲欧美日产图| 欧美国产综合一区二区| 欧美亚洲一区三区| 欧美日韩一区在线观看视频| 99pao成人国产永久免费视频| 黄色精品一区| 欧美激情日韩| 欧美成人精品福利| 日韩一级黄色大片| 另类天堂视频在线观看| 欧美高清视频一区| 99国产精品视频免费观看一公开| 牛夜精品久久久久久久99黑人| 欧美国产欧美亚洲国产日韩mv天天看完整 | 韩日午夜在线资源一区二区| 久久疯狂做爰流白浆xx| 亚洲日本一区二区| 亚洲特级毛片| 性欧美8khd高清极品| 欧美高清视频一区二区| 亚洲人成绝费网站色www| 一级日韩一区在线观看| 久久精品理论片| 亚洲欧美日韩综合国产aⅴ| 国产精品成av人在线视午夜片| 欧美高清视频一区二区| 亚洲乱码国产乱码精品精98午夜 | 国产三级精品三级| 亚洲经典一区| 在线精品亚洲| 欧美诱惑福利视频| 亚洲欧美日产图| 国产一区二区三区久久精品| 一二三四社区欧美黄| 欧美在线三级| 亚洲欧洲在线视频| 久久精品主播| 亚洲精品欧美极品| 久久激情五月激情| 国产精品亚洲精品| 久久在线免费| 亚洲夜晚福利在线观看| 欧美电影免费观看网站| 亚洲女爱视频在线| 亚洲国产色一区| 母乳一区在线观看| 亚洲小说欧美另类婷婷| 免费成人在线观看视频| 好看不卡的中文字幕| 欧美久久一级| 亚洲毛片在线| 理论片一区二区在线| 亚洲综合日韩在线| 国产精品免费网站| 午夜精品久久久久99热蜜桃导演| 一个色综合av| 韩国三级在线一区| 国产精品伦理| 欧美精品激情在线观看| 亚洲人人精品| 欧美jizzhd精品欧美巨大免费| 在线不卡中文字幕| 国产精品亚洲不卡a| 欧美绝品在线观看成人午夜影视| 久久久久久久高潮| 欧美国产视频一区二区| 久久国产黑丝| 午夜精品久久久久久久| 一区二区三区精品国产| 国产精品成人免费视频| 欧美成人首页| 欧美成年人视频网站| 久久国产免费| 香蕉精品999视频一区二区| 久久久久久久网站| 亚洲国产合集| 欧美日韩亚洲高清| 欧美肥婆在线| 欧美激情一区在线观看| 媚黑女一区二区| 久久亚洲电影| 麻豆精品视频| 免费欧美高清视频| 免费看av成人| 欧美国产日韩一区| 欧美精品二区三区四区免费看视频| 久久综合中文字幕| 久热精品视频在线免费观看| 久久亚洲一区二区| 免费短视频成人日韩| 欧美xx视频| 欧美日韩岛国| 国产精品第13页| 国产精品色在线| 国产视频一区在线观看| 国产一区二区三区精品欧美日韩一区二区三区 | 伊人精品在线| 亚洲黄色成人网| 99视频在线观看一区三区| 99精品视频免费观看视频| 中日韩美女免费视频网址在线观看 | 亚洲欧美成人| 久久久久9999亚洲精品| 免费的成人av| 亚洲毛片播放| 亚洲欧美制服另类日韩| 久久久夜精品| 欧美精品一区二区三区在线看午夜| 欧美激情在线狂野欧美精品| 欧美日韩亚洲一区二区三区在线观看 | 在线一区欧美| 欧美一区免费视频| 免费欧美日韩| 国产精品久久久久9999高清| 狠狠色狠色综合曰曰| 91久久精品日日躁夜夜躁国产| 一区二区欧美日韩视频| 久久福利一区| 91久久精品一区二区别| 亚洲欧美激情视频| 日韩一级黄色大片| 欧美一进一出视频| 欧美精品日韩精品| 国产午夜精品一区二区三区欧美| 亚洲第一区在线观看| 亚洲综合好骚| 亚洲第一毛片| 免费欧美日韩| 亚洲视频福利| 蜜桃精品一区二区三区| 国产精品久久久一区二区三区 | 亚洲男人的天堂在线aⅴ视频| 久久久一二三| 麻豆九一精品爱看视频在线观看免费| 最新国产乱人伦偷精品免费网站| 亚洲一区二区免费视频| 亚洲一区二区三区四区中文| 媚黑女一区二区| 国产欧美一区二区精品秋霞影院 | 亚洲国产精品女人久久久| 亚洲免费视频网站| 欧美激情在线| 欧美自拍偷拍| 国产精品美女久久久免费| 亚洲精品日韩在线观看| 久久综合色天天久久综合图片| 一区二区电影免费观看| 欧美国产激情| 在线观看视频欧美| 久久精品一二三区| 亚洲女人天堂av| 欧美午夜精品久久久久久超碰| 最新热久久免费视频| 狂野欧美激情性xxxx| 欧美在线观看www| 国产伦精品一区二区三区视频黑人| 9人人澡人人爽人人精品| 欧美ed2k| 久久人91精品久久久久久不卡| 国产私拍一区| 久久精品国产精品亚洲综合 | 午夜精品久久久久久久白皮肤| 欧美日韩精品欧美日韩精品| 亚洲高清在线| 欧美成人免费全部| 久久综合狠狠综合久久激情| 国产在线拍偷自揄拍精品| 亚洲国产精品成人一区二区| 久久久久成人网| 久久国产一区| 一区二区在线视频播放| 久久综合五月天婷婷伊人| 久久久久国产精品一区二区| 永久久久久久| 欧美黄色网络| 欧美精品日韩综合在线| 一区二区三区色|