How to select Document Mode in Firefox and Chrome without setting a DOCTYPE?

BVB picture BVB · Feb 13, 2013 · Viewed 10.7k times · Source

I am working on converting a web page that was creating using old web standards to support modern web browsers. The web page currently renders in Quirks Mode within Internet Explorer 9, Firefox, and Chrome.

In IE9, I am able to select the "Document Mode" in which I would like the web page I am viewing to render in. This makes things easier, as I can jump between Quirks Mode and IE9 Standards Mode. I do not have to add/modify the DOCTYPE tag within the code of the web page.

Can I do the same in Firefox and Chrome?

Answer

David Storey picture David Storey · Apr 19, 2013

No. In most browser–except IE–there are three different modes:

Quirks mode

This is where browsers wilfully do not follow certain standards in order to be compatible with broken content. IE < 10 is frozen in IE5.5 era quirks mode. Other browser’s quirks mode, including IE10 have evolved to be interoperable with each other, so they break in more predictable ways.

The usual method of setting quirks mode is not not include a doctype, or include content before the doctype.

It is highly recommended not to rely on quirks mode rendering.

Almost standards mode

This renders like standards mode, except the behaviour of vertical sizing of table cells.

Triggered with a doctype of:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Standards mode

This is the mode developers should be using, with browsers behaving to the defined standards. Triggered by using a valid doctype such as <!DOCTYPE html>

There is no way to set any other modes in Non-IE browsers. You can find out more at http://hsivonen.iki.fi/doctype/

I’d advise just to try to update the site to standards mode if you can, as it will only cause more issues the longer it is left in legacy rendering modes. It will also not take advantage of enhancements in modern versions of IE, such as performance improvements.