Exclude Javascript in Internet Explorer 7

Discussion in 'HTML & Website Design' started by caffeinatedworld, Aug 1, 2009.

  1. #1
    Hello everyone!

    I have never had these kind of issues before - conditional tags always did the trick, but for some reason this time they don't.

    I need to exclude one line under Internet Explorer 6:
    If I do this with <!--[if !IE 6]> it doesn't work :(

    If there are no HTML tags to do this I can also use a JS solution if there is anything you can offer.

    Any help guys! Thanks in advance.
     
    caffeinatedworld, Aug 1, 2009 IP
  2. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The proper way to exclude a version of IE6 is to use:

    
    <![if !(IE 6)]><script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/colors.js.php"></script><![endif]>
    
    Code (markup):
    The code above will include all non-IE and IE browsers except for IE6. The difference between this and the code you used is your use of <!-- and --> (which would disable the enclosed code in all non-IE browsers), and your use of "if !IE 6" (as "IE 6" should be grouped in parentheses).
     
    AssistantX, Aug 1, 2009 IP