11

I got such warning:

HTML1115: X-UA-Compatible META tag ('IE=9, IE=8, chrome=1') ignored because document mode is already finalized.

when I try to open my website at IE9. I have addthis script:

<script type="text/javascript" src="https://s7.addthis.com/js/250/addthis_widget.js#async=1"></script>

which adds google+ button

<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>

When I comment this line - warning disappear. How I can fix this?

Viacheslav Kondratiuk
  • 8,493
  • 9
  • 49
  • 81

1 Answers1

17

The x-ua-compatible meta tag must come before all other elements that aren't meta or title.

Otherwise, I think the document mode is already decided and IE will ignore later attempts to cue it as to which doc mode to use.

jinglesthula
  • 4,446
  • 4
  • 45
  • 79
  • 3
    Tried this, without success :( – Viacheslav Kondratiuk Jul 11 '12 at 07:15
  • Ah, according to the article here: http://evolpin.wordpress.com/2011/02/25/ie9-compatibility-and-the-meta-tag/ It must be the very first even among meta tags. unfortunately I favor charset=utf-8 over this browser specific tag, since the charset needs to be really early. – Kzqai Aug 15 '12 at 21:27
  • Paraphrasing Timo Lehto: As to whether the declaration needs to be the very first element in the header or not. It doesn't need to be the first, so long as it is only preceded by other meta tags or title tag in the header. Here's some quotes from MSDN: "The X-UA-Compatible header isn't case sensitive; however, it must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements." – jinglesthula Nov 08 '13 at 18:03
  • paraphrase continued: If you're having trouble making bowsers realise this be sure to reset browsers/servers cache. It may also be an option for you to make your web server set the compatibility mode on the http headers: "A web server can also be configured to specify the X-UA-Compatible header. If a web server specifies the header and the header also appears within the content of a webpage, the header in the webpage takes precedence over the one specified by the server." – jinglesthula Nov 08 '13 at 18:03
  • I think I've seen things where an extra space or newline before either the doctype or the html tag messes with this kind of thing. For those who had this not work for them you could check what was sent over the wire and make sure it looks like you aren't having content sent that trips the doc mode decision. – jinglesthula Apr 16 '14 at 18:10