{"id":1720,"date":"2012-08-28T07:49:56","date_gmt":"2012-08-28T12:49:56","guid":{"rendered":"http:\/\/www.wiredprairie.us\/blog\/?p=1720"},"modified":"2012-09-04T10:28:50","modified_gmt":"2012-09-04T15:28:50","slug":"forcing-ie-to-run-as-ie9-with-embedded-web-browser","status":"publish","type":"post","link":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1720","title":{"rendered":"Forcing IE to run as IE9 with embedded web browser"},"content":{"rendered":"

If you embed IE in a windows application, you may notice that it runs in IE7 Emulated mode. This is likely NOT what you want.<\/p>\n

I\u2019ve added code like below to solve the problem:<\/p>\n

string <\/span>appName = ""<\/span>;\ntry\n<\/span>{\n appName = Path<\/span>.GetFileName(Assembly<\/span>.GetEntryAssembly().Location);\n<\/p>

const string <\/span>IE_EMULATION = @"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION"<\/span>;\u2028
using <\/span>(var <\/span>fbeKey = Registry<\/span>.CurrentUser.OpenSubKey(IE_EMULATION, true<\/span>))\u2028
{ \u2028
fbeKey.SetValue(appName, 9000, RegistryValueKind<\/span>.DWord);\u2028
}
}<\/p>catch<\/span>(Exception <\/span>ex)\n{\n MessageBox<\/span>.Show(appName + "\\n" <\/span>+ ex.ToString(), "Unexpected error setting browser mode!"<\/span>);\n}<\/pre>\n

There\u2019s a special registry key that must be set before IE9 loads and is navigated \u2026 it must be set to the name of your application. Oddly, not the full path to your application, just the name of your executable.<\/p>\n

You may want to delete this registry setting when your application exits.<\/p>\n","protected":false},"excerpt":{"rendered":"

If you embed IE in a windows application, you may notice that it runs in IE7 Emulated mode. This is likely NOT what you want. I\u2019ve added code like below to solve the problem: string appName = ""; try { appName = Path.GetFileName(Assembly.GetEntryAssembly().Location); const string IE_EMULATION = @"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION";\u2028 using (var fbeKey = Registry.CurrentUser.OpenSubKey(IE_EMULATION, true))\u2028 […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[4],"tags":[82,108,79,116,16],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pd5QIe-rK","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":741,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/741","url_meta":{"origin":1720,"position":0},"title":"How to set Internet Explorer 8 View Source Tool\/Editor","date":"March 22, 2009","format":false,"excerpt":"IE8 includes a new syntax highlighting View Source tool similar to what is available in other web browsers. However, you may not want to use the built-in, view-only tool. It\u2019s easy to change. 1) Start Internet Explorer 8 if it isn\u2019t already started. Within IE8, click the Tools menu, then\u2026","rel":"","context":"In "General"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2009\/03\/image7.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1710,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1710","url_meta":{"origin":1720,"position":1},"title":"Announcing Html Grabber v3 (The Spy Who Loved Embedded Internet Explorer)","date":"August 20, 2012","format":false,"excerpt":"It\u2019s been a long time since v2 of the Html Grabber. I updated the Html Grabber earlier this year in response to some requests at work. It was performing poorly with long documents, and occasionally crashing in a few edge cases. I rewrote a few portions of the core code\u2026","rel":"","context":"In "Software"","img":{"alt_text":"SNAGHTML120cc9e2","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2012\/08\/SNAGHTML120cc9e2.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1140,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1140","url_meta":{"origin":1720,"position":2},"title":"HTML 5 Support: iOS 4.1 Browser vs. Windows Phone 7 Browser","date":"September 17, 2010","format":false,"excerpt":"Now that the final v1 Windows Phone 7 is available, I performed a few browser tests using http:\/\/www.HTML5Test.com (which is a slick and easy way of testing browser support for some upcoming HTML5 features). Any guesses which is iOS 4.1? \u00a0 Biggest missing elements from the IE browser on Windows\u2026","rel":"","context":"In "Phone"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2010\/09\/image7.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1705,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1705","url_meta":{"origin":1720,"position":3},"title":"WinRT\/Xaml\/AKA Metro DataTemplate selection based on Data Types","date":"August 20, 2012","format":false,"excerpt":"You may have noticed that WinRT does not have automatic resolution of a DataTemplate based on the data type of object added to an ItemsControl. While unfortunate as this behavior is quite handy, it\u2019s not too difficult to replicate the functionality using a DataTemplateSelector. WPF for example, could do something\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":518,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/518","url_meta":{"origin":1720,"position":4},"title":"Google’s Operating System Announced!","date":"September 1, 2008","format":false,"excerpt":"ReadWriteWeb brings news from on high of a new web browser headed from the hills (or from Google's headquarters). They report that Philipp Lenssen received a comic book in the mail that was drawn by Scott McCloud (author of Understanding Comics) which \"details\" out the plan for the new browser,\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/09\/image1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1016,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1016","url_meta":{"origin":1720,"position":5},"title":"Silverlight vs. Flash vs. Photoshop Text Rendering","date":"March 24, 2010","format":false,"excerpt":"Curious about text rendering characteristics between Flash 10, Silverlight 4.0 and Photoshop, I created two small applications, one in Flash CS 4, and one in Visual Studio 2010. The Silverlight 4.0 tests are using the release candidate which was current as of March 23, 2010. I used Times New Roman\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2010\/03\/image_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1720"}],"collection":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/comments?post=1720"}],"version-history":[{"count":3,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1720\/revisions"}],"predecessor-version":[{"id":1727,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1720\/revisions\/1727"}],"wp:attachment":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/media?parent=1720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/categories?post=1720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/tags?post=1720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}