Search code examples
javascripthtmlinternet-explorerconditional-comments

Don't load script in IE6 or less


How can I add a condition so that if a user is running IE6 or less not to load some javascript. I've tried the following, and the <script> doesn't load in any browser:

<!--[if gt IE 6]>
<script blah blah blah... />
<![endif]-->

<!--[if ! IE 6]>
<script blah blah blah... />
<![endif]-->

<!--[if !IE 6]>
<script blah blah blah... />
<![endif]-->

Some assistance would be much appreciated.


Solution

  • Try this:

    <!--[if gt IE 6]><!-->
    <script blah blah blah... />
    <!--<![endif]-->
    

    The above syntax (with the extra comment delimiters) is explained in this post.