11

IE9 is supposed to support conditional comments. I have the correct MIME type: 'type="text/css"'. All of the other conditional style sheets are being read into the correct browsers.

Here is what I cannot get to read in:

<!--[if IE 9]><link rel="stylesheet" type="text/css" href="includes/ie9.css"><![endif]-->

It is in the head with the rest of them, yet will not show up in the head in IE9.

TylerH
  • 19,065
  • 49
  • 65
  • 86
cantch00seaname
  • 113
  • 1
  • 1
  • 4

2 Answers2

19

Sorry for the dumb questions but, have you cleared the cache and tested (try setting some border-color or something)? Is the css file path correct and accessible through your http server (try opening it with your browser and testing if it works without the conditional statement)? Another thing, I would go with gte (greater than or equals).

<!--[if gte IE 9]>
        <link rel="stylesheet" type="text/css" href="includes/ie9.css" />
<![endif]-->

Also check it there is none X-UA-Compatible meta tags around doing their usual monkey business (Nothing to do with conditional statements, but seems to be the root of many evils lately).

Anthony Accioly
  • 19,883
  • 7
  • 62
  • 102
  • Ah, figured it out just as I read your comment. You are right it was the X-UA stuff. Everything was set to content='IE=6". I am dealing with legacy code here and it's not pretty. I really appreciate your help on this one Anthony. I can finally get some clients off my back. – cantch00seaname May 10 '11 at 18:16
6

I just tried this and it works

    <!--[if IE 9]>
    <script type="text/javascript">
    javascript:alert(document.documentMode);
</script>
<![endif]-->
Aamir Shahzad
  • 5,940
  • 8
  • 43
  • 62
Nerudo
  • 742
  • 1
  • 6
  • 11