2

I am designing an HTML website within a company website and I am having serious pain with IE 8 which enters Quirks Mode. I am using several CSS and Javascripts to format the HTML.

I have Googled for solutions to move from Quirks Mode into Internet Explorer 8 standards mode, which involved adding the following lines:

  1. <!DOCTYPE html> at the beginning of my html
  2. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> in the <head> tag.

However, since my HTML is embedded within the company HTML, and the company HTML begins with this line:

<HTML xmlns:o="urn:schemas-microsoft-com:office:office" dir="ltr">

Internet Explorer automatically launches into Quirks Mode and rearranges all my formatting despite the previous solutions that I have used.

And since I do not have any access/control over the company HTML, I am unable to add the <!DOCTYPE html> to the beginning of the company HTML.

For my circumstance, is there anything that I can do to force IE8 to not load the Quirks Mode? I have thought of writing a C# program that will force reload IE8 into standard mode, but I am unsure if it will be efficient.

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
Shing Zhao
  • 39
  • 1
  • 6
  • 1
    Once the page is loaded, there is no way to change the document mode. Can you talk to someone to see if you can edit the main HTML page? How exactly would a C# program even help? Unless you can set the `X-UA-Compatible` header or add a DOCTYPE, you may be out of luck. – gen_Eric Jul 17 '13 at 16:24
  • 3
    Convince the company to use a DOCTYPE for their website. – MiniRagnarok Jul 17 '13 at 16:24
  • 2
    You can consider using an iframe to display your own document/doctype – RyanS Jul 17 '13 at 16:31
  • I knew I should have put a full answer -___- – RyanS Jul 17 '13 at 16:42
  • @RyanS Do it. It's not too late. – MiniRagnarok Jul 17 '13 at 16:44
  • In fact its just the right time! Lunch time! Oh stack-overflow how I love to hate you while at work – RyanS Jul 17 '13 at 16:48
  • 1
    @RyanS: It's already Thursday where I am :) – BoltClock Jul 17 '13 at 17:01
  • You can also add an `X-UA-Compatible: IE=edge` HTTP header when serving the HTML page, but I am assuming that server access to add headers is going to be even more difficult than changing HTML files in a company like that. – Dave Methvin Jul 17 '13 at 18:01

1 Answers1

3

If you wrap your document in an iframe it should render that page with the declared doctype

You can even link straight to your own page :D

<iframe src="http://mycompany.com/mypage.html"></iframe> 
RyanS
  • 3,964
  • 3
  • 23
  • 37
  • 1
    Which standard suggests this behavior? As far as I know, a document in the iframe is almost completely independent from the host page, and is displayed in its own mode. Only IE9 and IE10 have the special mode for the page with quirks doctype in the iframe on the page with standard mode doctype, but even this mode is actually something in between the standards mode and the quirks mode (the broken CSS values are not ignored, but some newer JS features work and document.documentMode is reported to be equal to IE version). – Ilya Streltsyn Jul 17 '13 at 17:10
  • @IlyaStreltsyn Not sure what you're asking exactly, I dont have any official source, just a hunch ;) – RyanS Jul 17 '13 at 17:12
  • 1
    My test for the page with quirks mode doctype in the iframe on a standard page is here: http://selenit.freeoda.com/IE9/host.htm (red color of blocks means that the page is in Quirks mode or something like it). According to this test, I have to say that your hunch was not right:( – Ilya Streltsyn Jul 17 '13 at 17:14
  • Found the following question: http://stackoverflow.com/questions/3717932/will-an-iframe-render-in-quirks-mode. According to the answers, in IE8 and below "the webpage within the iframe would render according to its own doctype, not according to the doctype of the parent container", but since IE9 the quirks page in the iframe on a standard page is rendered in something called "Quirks mode emulation" within the newest engine. – Ilya Streltsyn Jul 17 '13 at 17:22
  • @IlyaStreltsyn Darn, good to know I guess. Lucky for the OP that they only wanted IE 8 then I suppose :p – RyanS Jul 19 '13 at 19:33