Search code examples
javascriptinternet-explorerinternet-explorer-6cross-browserconditional-comments

if IE conditional comments not working


It seems like a silly question, but I'm stumped.

I'm using an if IE conditional statement to fix some issues in IE6.

In the head, I have

<!--[if lt IE 7] > <script type="text/javascript" src="js/ie6.js"></script> < ![endif]-->

And in the ie6.js file, I have a simple alert, which works when I take it out of the conditional comment. But in IE, the alert does not show. I am testing on IE 6.0.2900 on Windows XP in Parallels Desktop.


Solution

  • Try it without spaces in the tags:

    <!--[if lt IE 7]>
    According to the conditional comment this is Internet Explorer lower than 7
    <![endif]-->