0

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!

2
  • May I ask why would you want to do this? Commented May 10, 2009 at 14:45
  • I am doing some fancy javascript stuff that is not supported by <=IE6 so for visitors using those browsers I want to serve the fully functional page without the javascript enhancements Commented May 10, 2009 at 15:07

4 Answers 4

3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

0

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.

Comments

0

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

1 Comment

The browser object is deprecated in jQuery 1.3+.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.