IE8 and quirks mode - html

Does IE8 run in quirks mode like IE6/7?
I have a webpage that has some truly bizarre code. The content is centered with padding and negative margins.
It works correctly in IE6/7 and other browsers but in IE8 the content area is half as wide and not centered (flag for quirks mode).
The source code has three blank lines before the DOCTYPE. I know that will throw IE6 into quirks mode. Will it also affect IE8?
I don't have access to the source so I cannot remove those lines to test it.

Changing the doctype to HTML 5 should fix some problems. I had an issue with min-width in IE8 using Strict doctype.
So changed this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
To this: <!DOCTYPE html>
See here: http://davidnaylor.org/blog/2008/09/ie8-and-max-width.html

Running a few quick tests that can be found here seem to indicate that blank lines shouldn't throw IE8 into Quirks Mode (which is different to Compatability Mode that everyone seems to be confusing it with).
I wrote a breakdown on how incredibly confusing the different modes of IE8/7 here and I didn't even include Quirks Mode in the breakdown. A detailed description of Quirks mode can be found here (not for the original question, but others might find it interesting.)

Today, I changed our DOCTYPE from XHTML v1.0 (Strict) to HTML5. I read somewhere that even though the IE's don't recognize the DOCTYPE yet, they will render the page in standards-compliant mode.
When I checked in IE8, the whole page looked whack (we have quite a bit of CSS and other styling). It took a while before I realized that there wasn't anything "wrong" with the CSS, or even IE8 for that matter. However, it WAS rendering in quirks mode.
Inadvertently, I found the answer in the question posted here, specifically this comment: "The source code has three blank lines before the DOCTYPE. I know that will throw IE6 into quirks mode. Will it also affect IE8?"
I don't know about blank lines, but when I made the change, I had used a javascript comment to "hang on to" my old DOCTYPE statement (which was ABOVE the new HTML5 DOCTYPE). Once I removed those lines (which may have included a blank line or two), my sweating stopped and IE8 rendered in standards-compliant mode.

Yes it does. Internet Explorer's quirks mode is IE5.5. IE6/7/8 switch back to 5.5 when quirks mode is present. So since it was working fine in IE6/7 it's not the quirks mode. There's a "Compatibility View" button in IE8 to address this issue. It's not a good solution to me though. You'll have to check your CSS code.

IE8 has a compatibility mode which should treat the page the way IE7 would. Have you tried viewing the page in compatibility mode?

Can you post a link to the page or some of the HTML itself? You could try adding the meta tag to force compatibility mode?
http://www.ditii.com/2008/08/28/ie8-standards-mode-and-ie7-compatibility-mode/
or for more info:
http://blogs.msdn.com/ie/archive/2008/08/27/introducing-compatibility-view.aspx

Related

Using html5 quirks mode in IE9

I've created a form that is dynamically created with JavaScript and is added in another website using the <script> tag.
The doctype used by this other website is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> which uses the quirks mode.
I've built my form by taking this in consideration and everything is working as expected in Chrome, Firefox and IE 10. However, when I test it in IE 9 and earlier, the form is not displayed at all. When I open the developper tools, I can see that IE 10 uses the new quirks mode but IE 9 and earlier uses the IE5 Quirks mode.
I was wondering if the new quirks mode can be used to display this page when using IE 9 and earlier. If this is not possible, I would like to force standard mode but only when using IE 9 or earlier and keep using quirks for every other browser.
I can't use the html5 doctype since their website is built with quirks mode instead of standards and their design is all broken when I use this doctype.
You cannot change the mode once the page is loaded. And you cannot change it programmatically. The only way to force a page into quirks mode is to load it without a valid doctype or with serious bugs in the HTML.
If you have a doctype, but your page is still loading in quirks mode, then it means that you have serious bugs in your HTML. This will give you bigger problems than just being in quirks mode. You should definitely fix those bugs. If you really want to be in quirks mode, drop the doctype, but you should really try not to have HTML code that is so bad it triggers quirks mode even with a doctype!
You can validate your HTML to find those bugs by using the W3C validator.
In terms of switching your page at runtime between IE10's two different quirks modes, the simple answer is that you can't do that.
Sorry about that.
However, to be honest, it's probably for the best. Using quirks mode is be a complete disaster anyway. It doesn't just change the layout mode; it also switches off most of the browser's features (ie pretty much everything invented since 1998).
But now for the good news:
Luckily, switching away from Quirks mode is a lot easier than you think.
The main layout issue (the different box model) can be fixed by adding the following to the top of your CSS:
*{box-sizing:border-box;}
This is the standards-compliant way to set the box model to the quirks-mode style layout. Most of the broken layout problems cause by switching from quirks mode to standards mode can be resolved with this simple CSS style.
There are other quirks, but they're relatively minor and shouldn't be too hard to deal with once you've fixed the main issue. A lot of them are actually not quirks mode issues, but bugs in older IE versions that the original coder may have had to hack his way around. There's no guarantee that these will continue working the same in future versions anyway, even if you do stick to quirks mode, so you would be best off fixing them now anyway.
So, to summarise:
Fix your page so it loads in standards mode. Valid doctype and valid HTML.
Use box-sizing to mitigate the main layout gremlins caused by the switch.
Fix the remaining layout issues manually.
It's really a lot less work than it sounds. Honest.

Tagcanvas with colorbox overlay is throwing IE9 into quirks mode?

I have implemented a tagcloud onto my webpage, instead of words I am using images and I am calling colorbox to provide a nice styled overlay and a biography of that person.
All of this works correctly in EVERY browser except IE.
I am using another colorbox overlay that does work on that same page, it is not in the tagcanvas area.
I noticed the IE9 Console throwing this at me:
HTML1113: Document mode restart from IE9 Standards to Quirks
Has anyone seen this before? Is there a way to stop it from switching to Quirks mode? I have tried a few different doctypes, even some meta tags like:
<meta http-equiv="X-UA-Compatible" value="IE=9">
Still, no dice! Ideas?
Your doctype is probably missing an FSI.
Doctype sniffing works by detecting which of these parts are present in the doctype declaration. If an FPI is present, but an FSI isn’t, browsers generally choose quirks mode, since this was the common way of writing doctype declarations in the old days. Browsers also choose quirks mode if the doctype declaration is missing altogether—which used to be very common—or is malformed.
See: http://reference.sitepoint.com/css/doctypesniffing

IE breaking page, and invalid markup validation

I have finished the layout and completed the webpage (www.blisshair.com.au) but i have run into what I think is a major issue.
When building the webpage, I only used firefox to check the layout, and now I am kicking myself.
When loading the page in developer tools, IE 8 standards, browser IE 8, it loads pretty much perfect, except the header logo is twice as big as it should be.
When trying in I.E 7 standards, browser IE 7 it looks ok, however, IE browser 7, quirks mode, the page breaks down :
Have a clearfix issue just above the bottom footer, and the navigation (side) menu paddings are way off, the container div isn't centered (at least not on the index page, all other pages are..? )
I honestly have no idea whats going on, if someone could point me in the right direction I would really appreciate it,
Also, one last issue I was trying to correct and has left me scratching my head, I was trying to validate from W3C and got this error:
Warning DOCTYPE Override in effect!
The detected DOCTYPE Declaration
""
has been suppressed and the DOCTYPE
for "XHTML 1.0 Transitional" inserted
instead, but even if no errors are
shown below the document will not be
Valid until you update it to reflect
this new DOCTYPE.
I thought "DTD XHTML 1.0 Transitional" was correct?
If it helps, I have made a header and a footer html and attached them via include with php.
thanks again,
Nik.
EDIT : Problems resolved, thanks again to this site :)
There's not much actually wrong with your site, so don't worry.
When loading the page in developer
tools, IE 8 standards, browser IE 8,
it loads pretty much perfect, except
the header logo is twice as big as it
should be.
I don't see this in IE8 with IE8 Standards Mode, it looks the same as Firefox.
When trying in I.E 7 standards,
browser IE 7 it looks ok
This is the same as using your site with Internet Explorer 7. It's good that your website works properly here, because it still has some market share.
however, IE browser 7, quirks mode,
the page breaks down
Quirks Mode is basically emulating IE5. You do not have to worry about your website working in IE5. A visitor would only see your site in Quirks Mode if you had an invalid doctype that would not trigger Standards Mode.
Your doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
That's fine, and will most definitely trigger Standards Mode.
Your site does have some validation errors, but none of them are of the fatal variety.
however, IE browser 7, quirks mode, the page breaks down
Shrug, who cares? Quirks Mode is an emulator for IE 5.5, which no-one has used in years. You might today still worry about about what it looks like in IE6 Standards Mode, depending on who your audience are, but certainly nothing earlier than that. As long as your <!DOCTYPE> declaration is in place as it is now, no-one will ever see your page rendered in Quirks Mode.
I thought "DTD XHTML 1.0 Transitional" was correct?
Yeah, it is. The validator is just warning you that you've chosen to ignore the doctype on the page, in favour of explicitly using XHTML 1.0 Transitional (which is the same doctype as on the page anyway, but the warning doesn't notice that). Just leave the “document type” dropdown on the validator form on ‘(detect automatically)’ and the warning will go away.

Run quirks mode in one frame and standards mode in another?

I have an old application that uses frames (not iframes) was was written back in the IE6 days so it runs in quirks mode.
Is it possible (Using IE 7 or 8) to have one frame still in quirks mode and another in standards mode or must the whole browser be in one mode or another?
I've been trying with no success.
I've seen this answer, that applies to iframes, but what about plain-old-frames?
I believe that you don't get the same option with frames as you do with an iframe. As the linked question's answer stated, the target in an iframe is not dependent upon the parent. In regular frames the pages all rely on the parent. I don't think you can separate the types out.
I'm not sure if this helps, but according to the Mozilla Dev center Firefox makes it's quirksmode decisions based on doctype only.
https://developer.mozilla.org/en/Mozilla's_DOCTYPE_sniffing
You'll notice using the old frameset doctype triggers "almost standards" mode, which could show up as quirksmode.
See my answer here for MSDN-documented solution for IE9: How to force Iframe to run quirks under a standard parent frame
In short, it is not possible to trigger quirks mode in a frame (or iframe) if the parent page is rendering in IE9 mode, but it is possible to trigger "quirks mode emulation" embedded in the IE9 rendering engine.
JSBin demo: http://jsbin.com/ozejuk/1/
Further reading: http://msdn.microsoft.com/en-us/library/gg558056(v=vs.85).aspx
If you can modify the code (or HTML) of the application, you can add a meta tag (just below head), so it forces IE to render it in Quirks mode, like this:
<meta http-equiv="X-UA-Compatible" content="IE=5">

Will adding rel or name attributes to divs and spans cause IE/FF to go into quirks mode?

Will a tag like
<span id="suchAndSuch" class="blah" rel="this.that.other" name="this.name"></span>
or
<div id="suchAndSuch" class="blah" rel="this.that.other" name="this.name"></div>
throw IE and/or FF to QM? According to W3C, those aren't standard attributes for those tags, but it does not say if it'll make them invalid.
Your help is much appreciated.
No, it will not throw a browser into quirks mode. Not having a DOCTYPE or having a HTML comment (or any HTML content) before a DOCTYPE will throw browsers into quirks mode.
If you can avoid using custom attributes, you should. If you cannot, you might want to consider using a HTML5 doctype, and then using data attributes. For instance, what you wrote could be done like this:
<div id="suchAndSuch" class="blah" data-references="this.that.other" data-name="this.name"></div>
And that would still be valid, as well as supported by modern browsers (and even a number of older ones).
You have to be using a valid doctype and it needs to be the first thing found in the file. I haven't tested the behavior of a strict doctype and custom attributes but I know for sure that a transitional doctype works with custom attributes.
I think the key is to have a valid doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Quirks mode should only ever be triggered based on the (lack of) DOCTYPE specified for the document.
In Firefox or IE, you can check the mode of a document by pasting the following in your address bar:
javascript:alert(document.compatMode)
The valid values for document.compatMode are BackCompat (for quirks mode) and CSS1Compat (for standards/strict mode).
In Firefox, you can also right-click on a document and click "View Page Info". The mode will be listed near the top as "Render Mode".
You can check how a page is being rendered by the following:
In Firefox go to Tools > Page Info and look at the 'Render Mode'.
In IE8 click on Tools > Developer tools and look at the 'Document Mode' at the top right.
For example, this page is rendered in 'Standards compliance mode' in Firefox and 'IE8 Standards' in Internet Explorer.
Thx all for the prompt answers. I went ahead and tested each of the tags above with the W3C validator and it indeed is invalid X/HTML (strict, I believe) to use rel or name in divs or spans.