views:

34

answers:

2

I have had to write some JQuery specifically for IE6, fixes some bugs with compatability between IE6 and IE8. However I only want to apply the IE6 JQUERY to IE6 and not have it load with IE8.

Can anyone suggest a way of detecting IE6 and running the IE6 Specific JQUERY?

+3  A: 
<!--[if IE 6]>
<script type="text/javascript" src="your_ie6_specific_script.js"></script>
<![endif]-->

You could also do this programatically:

if ($.browser.msie && $.browser.version === '6.0') {
    alert('ie 6.0');
}
Darin Dimitrov
How do other (non-IE) browsers deal with this tag? Surely they would not recognise it and thus end up loading the script anyway?
PP
To other browsers, it's just an HTML comment, so they will ignore the script tag.
Matthew Crumley
A: 
var IE6 = /msie|MSIE 6/.test(navigator.userAgent)
David