{"id":5695,"date":"2012-04-20T09:10:31","date_gmt":"2012-04-20T08:10:31","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/?p=5695"},"modified":"2012-04-20T09:10:31","modified_gmt":"2012-04-20T08:10:31","slug":"a-bug-in-embedded-internet-explorer-in-windows-8","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/5695-a-bug-in-embedded-internet-explorer-in-windows-8.html","title":{"rendered":"A bug in embedded Internet Explorer in Windows 8"},"content":{"rendered":"<p>Long-time readers of this site may remember that I did some work on embedding Internet Explorer, and its core rendering component MSHTML, in .NET applications. The code is <a href=\"http:\/\/www.itwriting.com\/htmleditor\/index.php\" target=\"_blank\">still online<\/a>.<\/p>\n<p>I noticed that it does not work properly in Windows 8 Consumer Preview. Specifically, plain HTML works but you can no longer apply external CSS stylesheets. I reported the bug <a href=\"https:\/\/connect.microsoft.com\/IE\/feedback\/details\/735421\/problem-linking-stylesheet-to-embedded-mshtml-in-windows-8-cp\" target=\"_blank\">here<\/a> (sign-in required).&#160; I did not use my own component, but rather the standard WebBrowser control. I have appended the code to reproduce the bug in case you cannot see the report.<\/p>\n<p>Microsoft has now responded as follows:<\/p>\n<blockquote>\n<p>We were able to validate your feedback. However, based on the limited impact this bug may have, we will not be able to address this bug during this release.<\/p>\n<\/blockquote>\n<p>This status is also known as \u201cwon\u2019t fix\u201d and gives me pause for thought. How many other little bugs are there which Microsoft is not fixing, but which break a certain number of applications?<\/p>\n<p>If you are one of those few people using embedded IE in an application, I suggest checking Windows 8 compatibility now to avoid any unpleasant surprises.<\/p>\n<p>Perhaps it would be preferable to use WebKit or Gecko (Mozilla) rather than IE in any case. There is a thread on stackoverflow that <a href=\"http:\/\/stackoverflow.com\/questions\/26147\/is-it-possible-to-embed-gecko-or-webkit-in-a-windows-form-just-like-a-webview\" target=\"_blank\">discusses some options<\/a>. <a href=\"http:\/\/code.google.com\/p\/open-webkit-sharp\/\" target=\"_blank\">OpenWebKitSharp<\/a> looks promising.<\/p>\n<h3>Code to reproduce the bug:<\/h3>\n<blockquote>\n<p>Create a Windows Forms application in C# in VS 11. Add a Webbrowser control and two buttons, and an OpenFileDialog control. Also add a reference to the COM library Microsoft HTML Object Library.<\/p>\n<p>Here is the code for the first button that loads some HTML:<\/p>\n<p>string sHTML = &quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;Some title&lt;\/title&gt;&lt;\/head&gt;&lt;body&gt;&lt;p&gt;Some text&lt;\/p&gt;&lt;\/body&gt;&lt;\/html&gt;&quot;;      <br \/>this.webBrowser1.DocumentText = sHTML;<\/p>\n<p>Here is the code for the second button that applies a stylesheet:<\/p>\n<p>openFileDialog1.Filter = &quot;CSS files|*.css&quot;;      <br \/>if (openFileDialog1.ShowDialog() == DialogResult.OK)&#160; {       <br \/>mshtml.HTMLDocument doc = (mshtml.HTMLDocument)this.webBrowser1.Document.DomDocument;       <br \/>doc.createStyleSheet(openFileDialog1.FileName);       <br \/>}<\/p>\n<p>This is the stylesheet I am applying:<\/p>\n<p>body      <br \/>{       <br \/>&#160;&#160;&#160; font-family: Arial;       <br \/>&#160;&#160;&#160; font-size: 18pt;       <br \/>}<\/p>\n<p>To reproduce, run the application. Click the first button to load the HTML. Then click the second button to apply the stylesheet. In Windows 7 and earlier the stylesheet is applied. In Windows 8, the stylesheet is not applied.<\/p>\n<\/blockquote>\n<p><strong>UPDATE<\/strong>: It seems this bug was fixed in Windows 8 RTM, despite the \u201cwill not fix\u201d designation. Good.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Long-time readers of this site may remember that I did some work on embedding Internet Explorer, and its core rendering component MSHTML, in .NET applications. The code is still online. I noticed that it does not work properly in Windows 8 Consumer Preview. Specifically, plain HTML works but you can no longer apply external CSS &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/5695-a-bug-in-embedded-internet-explorer-in-windows-8.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">A bug in embedded Internet Explorer in Windows 8<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,55,67,80,97],"tags":[493,615,996],"class_list":["post-5695","post","type-post","status-publish","format-standard","hentry","category-internet","category-microsoft","category-professional","category-software-development","category-windows","tag-internet-explorer","tag-mshtml","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/5695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=5695"}],"version-history":[{"count":0,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/5695\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=5695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=5695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=5695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}