0

I'm making a webpage for a browser extension and I want the download button to automatically download the relevant file for the browser the user is on.

I've found that jQuery's $.browser feature is now deprecated, so is there an easy way of detecting the user's browser?

2
  • Well there is a replacement github.com/gabceb/jquery-browser-plugin . But as far as i know it just reports webkit but not if it is chrome, safari or another browser that uses webkit. So probably a server side detection would be better using browscap or similar library. And using that to deliver the right extension. That way you would not need javascript to be activated. Commented Jul 29, 2013 at 14:23
  • I suggest modernizr.com. You can use it to find if an actual feature is supported. If you want you can detect browser also but I found that more useful. Commented Jul 29, 2013 at 14:38

3 Answers 3

2

If you want information about the browser that your visitor uses, and use it for statistics or displaying information to the user, you can use the jQuery Browser Plugin.

you can also use - navigator.userAgent for detect user browser.

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

1 Comment

This jQuery Browser plugin is what I was looking for - thank you very much!
1

Try to detect the features instead using jQuery.support

EDIT:

Then you can do it simply using navigator.userAgent (though parsing needed)

Decrypting the User Agent String in JavaScript

3 Comments

While it is generally more preferable to detect features than browsers, in this setting OP needs the browser to deliver the correct extension.
@Sirko You're right. Thanks for pointing it. Then OP can do it simply with navigator.userAgent (parsing needs) right?
The world of user agent strings is rather complex, if you want to do it right, but this approach might be a good start.
0

It can still be a pain with all the browser specific dependencies in old jQuery plugins.

Try using jQBrowser: http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/

Almost same syntax:

$.browser.browser();
$.browser.version.number();

Comments

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.