Take the 2-minute tour ×

How could I redirect the user if his browser doesn't support jQuery?

and is it possible to redirect if the browser doesn't support a specific version of jQuery (for example 1.3)?

share|improve this question

closed as not a real question by thecodeparadox, Neal, Wesley Murch, kapa, Jason Sturges Jul 14 '12 at 4:20


You're using jQuery 1.3?! –  Dave Newton Jul 12 '12 at 16:34
@DaveNewton sometimes you have no choice in the matter. –  iKnowKungFoo Jul 12 '12 at 16:35
@iKnowKungFoo Yes, I know. That doesn't make it any less surprising, though. I can't think of too many ways to justify sticking with 1.3. –  Dave Newton Jul 12 '12 at 16:38
add comment

3 Answers

There is no such thing as "a browser that does not support jQuery" - if the browser supports JavaScript then it also "supports jQuery".

However, the user might have disabled JavaScript. You can use <noscript> and put a meta redirect inside to redirect in this case.

It could also be possible that jQuery doesn't support the user's ancient browser. However, unless you have customers using relics like IE4 or NS4 that's extremely unlikely as of now (will be more likely after jQuery 2.0 is out which drops old-IE support). To ensure your jQuery-based code works in modern browsers you also need to use a modern version of jQuery, e.g. 1.7.2.

share|improve this answer
add comment

Curious as to what you mean since jQuery (at least currently) supports even IE6, so what browsers do you expect to be used? As TheifMaster says in his answer (and which I won't hijack and repeat here), you may actually want to look into <noscript> tags.

In any case, to your question: you'd need to make sure somehow that your script loaded after any possible jQuery, otherwise it would give an unreliable reading. Or stick it in a timeout, or something.

Detect jQuery:

if (!window.jQuery) //no jQuery...

Detect jQuery version

alert(jQuery.fn.jquery); //e.g. 1.7.2
share|improve this answer
add comment
top.location.href = 'url';

If JavaScript is still no good, you can use PHP:

  header('Location: url');
share|improve this answer
How would he detect JavaScript/jQuery not being supported with PHP? –  ThiefMaster Jul 12 '12 at 16:34
<noscript><?php header('Location: url'); ?></noscript> Like so. –  ZeeCoder Jul 12 '12 at 16:35
Are you serious about that? PHP runs on the server so the header would be sent in any case. Besides that, it would result in a "headers already sent" warning since you cannot send headers after sending non-header data. –  ThiefMaster Jul 12 '12 at 16:37
I still don't get it. –  Dave Newton Jul 12 '12 at 16:40
I'm not sure if it will work, but maybe you could have the original URL be a page that contains <NOSCRIPT><META REFRESH="mypage-nojs.php"/></NOSCRIPT> –  Barmar Jul 12 '12 at 16:52
add comment
