I currently using jquery in my website but when i try to open this website on ie 5.5 i get the error "$" is undefined so i am searching for a solution to detect if the browser support jquery or not before calling any jquery code
Asked
Active
Viewed 181 times
0
-
8why are you supporting ie 5.5?!?! – Daniel A. White Dec 12 '11 at 14:04
-
2here is the list of compatibility. http://docs.jquery.com/Browser_Compatibility – Daniel A. White Dec 12 '11 at 14:05
-
@DanielA.White: I think he wants to check it at runtime so that he prevents the error. – RightSaidFred Dec 12 '11 at 14:06
-
@Daniel A. White: Does the *why* matter? Sometimes, I still support IE5.5 - but I charge an arm and a leg for that, on top of the IE6 support fees (to dissuade the clients, mainly, and then to cover the development costs). Even so, some clients are still willing to pay for IE5.5 support. – Piskvor left the building Dec 12 '11 at 14:07
-
ignore 5.5 ... you can also ignore IE 6 becouse it is not recommended to use it anymore (by Microsoft!!) if you take a look at browser statistics IE 6 is used by like 1-5% of all IE users. Its ok to ignore it. 5.5 is not even in the statstics anymore !! that why! – ggzone Dec 12 '11 at 14:08
-
@Piskvor I would never take a project where I was asked to support IE 6 or below. Sorry, it's just not worth it IMHO. – Yuck Dec 12 '11 at 14:09
-
@Yuck: I would never take it at normal rates, either ;) It's a challenge, really - "can you make it work with IE5 and NN 4.78?" – Piskvor left the building Dec 12 '11 at 14:10
-
1@SamirAdel: You may want to check out [this question/answer](http://stackoverflow.com/a/4228216/376743) that shows a clever use of conditional comments as a non-spoofable way of detecting the version of IE. – RightSaidFred Dec 12 '11 at 14:11
2 Answers
1
I think you might have answered your own question. Check if $
is undefined. Thoguh as mentioned in the comments, IE 5.5 is not supported.
Edit
In case you needed the code to check if the alias for jQuery is undefined:
typeof $ == 'undefined'

Craig
- 6,869
- 3
- 32
- 52
-
That's going to read wrong on Prototype (which also uses `$`). Checking for `jQuery` is more foolproof. – Piskvor left the building Dec 12 '11 at 15:26
-