Felix Andersen
Felix Andersen

Reputation: 1391

Prevent javascript execution in IE6

I want to prevent some parts of my javascript, written with jQuery if that matters, from executing in IE6. What are the prefered methods to accomplish this?

Thanks!

Upvotes: 0

Views: 455

Answers (4)

Hank Gay
Hank Gay

Reputation: 71939

For your stated purpose, you should definitely use Progressive Enhancement instead of browser detection.

Upvotes: 0

Artem Barger
Artem Barger

Reputation: 41222

Since you have mentioned JQuery, why don't you use " if ($.browser.msie)" construction. I think this resource will be useful for you

Upvotes: 1

Tordek
Tordek

Reputation: 10872

You could use conditional comments to define a variable, and check if it's set on execution.

The syntax is <!--[if IE 6> <script ... /><![endif]-->. The content of the comment is invisible to all other browsers, so it's really foolproof.

Upvotes: 3

Vikram
Vikram

Reputation: 6877

You should just use a browser detection script and put a condition on IE6 that your scripts should not be executed. here is a link for browser detection javascript.

Upvotes: 0

Related Questions