user656925
user656925

Reputation:

Determining Browser Type and Version for Major Modern Browsers

I only support major modern browsers. Primarily b.c. I currently have limited resources and I have to support what I can and hit the browsers with the most users. My app only works with JavaScript turned on and a major modern browser. I have a JavaScript test in place and now I need to test for browser type and version for these browsers.

Google search pulls up:

W3 and Quirksmode

Quriksmode looks to cover too many bases for my needs and W3 I've been told is not the best reference.

The simplest solution I found and what I'd like to use is:

navigator.appName

to test for the type and

navigator.appVersion

to test for the version. Will this work for the limited cases I want to cover?

I don't want to use any libraries.

Upvotes: 0

Views: 492

Answers (1)

Eric J.
Eric J.

Reputation: 150108

Given your limited resources, consider using a framework like jQuery that attempts to manage the sometimes significant differences between browsers on your behalf.

Even if you don't want to use jQuery in general, I would still suggest having a look at it's browser detection capability

http://api.jquery.com/jQuery.browser/

Note that the .browser property is deprecated and may not be available in future versions of jQuery, because the team is focused not on specific browser versions, but on capabilities of the current browser

http://api.jquery.com/jQuery.support/

You would be wise to adopt a similar approach.

Upvotes: 3

Related Questions