Forcing Internet Explorer 9 to use standard document mode

How to force Internet Explorer 9 to use standard document mode? I created a website, and I found that IE9 uses quirks mode to display website pages. But I want to use the standards mode for rendering.

+70
html internet-explorer internet-explorer-9 quirks-mode
Jun 11 2018-12-12T00:
source share
9 answers
<!doctype html> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> 

This means that each version of IE uses its own standard mode, so IE9 will use IE 9 standards mode. (If instead you wanted newer versions of IE to also specifically use IE 9 standards mode, you would replace Edge with 9 But it's hard understand why you need it.)

See http://hsivonen.iki.fi/doctype/#ie8 for clarification (this looks pretty messy, but that's because IE is messy in its behavior).

+126
Jun 11
source share
 <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 

The meta tag must be the first tag after the header tag or it will not work.

+18
Mar 06 '14 at 18:41
source share

There is something very important in this thread that has been affected, but not fully explained. The HTML approach (adding a meta tag to the head) works sequentially on raw HTML pages or on very simple servers. My site is a very complex server site with main pages, themes and many third-party controls, etc. I found that some of these controls programmatically added their own tags to the final HTML that were clicked on the browser at the beginning of the title tag. It effectively rendered HTML meta tags to no avail.

Well, if you cannot defeat them, join them. The only solution that worked for me was to do the same in the event of pre-rendering my master pages as such:

 Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender Dim MetaTag As HtmlMeta = New HtmlMeta() MetaTag.Attributes("http-equiv") = "Content-Type" MetaTag.Attributes("content") = "text/html; charset=utf-8;" Page.Header.Controls.AddAt(0, MetaTag) MetaTag = New HtmlMeta() MetaTag.Attributes("http-equiv") = "X-UA-Compatible" MetaTag.Attributes("content") = "IE=9,chrome=1" Page.Header.Controls.AddAt(0, MetaTag) End Sub 

This is VB.NET, but the same approach will work for any server technology. For now, make sure that this is the last thing done before the page is displayed.

+10
Aug 20 '13 at 18:39
source share

type doctype in the first line of your html document

 <!DOCTYPE html> 

You can find a detailed explanation of document compatibility in Internet Explorer: Determining Document Compatibility

+6
Jun 11 '12 at 6:15
source share

To prevent quirks mode, define "doctype", for example:

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

To make IE render a page in IE9 document mode:

 <meta http-equiv="x-ua-compatible" content="IE=9"> 

Note that "IE=edge" will make IE render the page with the most recent document mode, not IE9 document mode.

+5
Jul 18 '13 at 0:32
source share

Please note that you are adding this tag.

 <meta http-equiv="X-UA-Compatible" content="IE=Edge"> 

may only be compatible with the latest versions. It all depends on your libraries.

+3
Nov 14 '13 at 0:58
source share

Make sure you use the correct doctype.

eg.

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

or simply

<!doctype html>

as well as reading and understanding how compatibility modes and the developer toolbar for IE work and set modes for IE:

0
Jun 11 2018-12-12T00:
source share

I tried an alternative method:

Press F12. Then, on the right side, select Internet Explorer version 9 from the drop-down menu.

That he and it worked for me.

0
Oct 26 '17 at 12:03 on
source share

I ran into a problem, as my index.jsp main page contains the line below, but even though the rendering was not correct in IE. Found a problem and I added code to all the files that I included in index.jsp. Hurrah! it worked.

Therefore, you need to add the code below to all the files that you include in the page, otherwise it will not work.

  <!doctype html> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> </head> 
0
May 22 '19 at 15:01
source share



All Articles