How can I add a condition so that if the user runs IE6 or less, so as not to load javascript. I tried the following, and <script> does not load in any browser:
<script>
<!--[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 help would be greatly appreciated.
Try the following:
<!--[if gt IE 6]><!--> <script blah blah blah... /> <!--<![endif]-->
The syntax above (with additional comment delimiters) is explained in this post .
Have you tried head.js ? You can load this first and wrap the actual script load in a state, for example:
<script> if(!isIE6) { head.js("path/to/script1.js", "path/to/script2.js"); } </script>
Use double negatives to exclude scripts from a specific version of IE
<!-- disabled all javascript in IE6 --> <!--[if gt IE 6]><!--> <script type="text/javascript"> // special not IE6 stuff </script> <!--<![endif]-->
Use a simple check to run scripts only on IE6
<!--[if lte IE 6]> <script type="text/javascript"> // special IE6 stuff </script> <![endif]-->
Let it read should help.
http://www.quirksmode.org/css/condcom.html
I only ever used [if IE 6], but it worked fine.
Just download the script for IE 7 and above.
<!-- [if gte IE 7]> <script type="text/javascript"> </script> <![endif]-->
MSDN Link.