2

I want only IE8 to work with compatibility mode. But I couldn't do it by using the first way below:

First way: (It doesn't work)

    <!--[if IE 8]>
        <com:TMetaTag HttpEquiv="X-UA-Compatible" Content="IE=EmulateIE7" />  
    <![endif]-->

Second way:

<script type="text/javascript">
     var $j = jQuery.noConflict();

     if($j.browser.msie && $j.browser.version == "8.0")
     {
         alert("<com:TMetaTag HttpEquiv=\"X-UA-Compatible\" Content=\"IE=EmulateIE7\" /> ");
     }

</script>  

Now I am trying to echo the meta tag by using jquery like above. But I don't know how to do that? So I alert it to show you the problem clearly.

Note: I am using a php framework named by prado. So the tag element is a little bit different like (<com:TMetaTag...)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Barış Velioğlu
  • 5,709
  • 15
  • 59
  • 105

2 Answers2

2

IE8 in compatibility mode is going to recognize as IE7.

Try

<!--[if lte IE 8]>

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
  • Actually this is the first way I have been tried before. The meta inside that tag is working for all IE versions. I think this is somehow related PRADO. Because I wrapped these meta tags not like . It is . Maybe it behaves different because of that but I am not sure. – Barış Velioğlu Jul 13 '11 at 13:35
1

Using Javascript, you would use the

document.write() 

Method to write directly into the HTML.

Edit: Didn't see you were using JQuery. This is probably a safer way of doing things:

$("head").append('<com:TMetaTag HttpEquiv="X-UA-Compatible" Content="IE=EmulateIE7" />')
SirensOfTitan
  • 799
  • 1
  • 7
  • 19