Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser version Detection

I have a spec in my current project that requires us to advise the user which browsers are best to use the web application. If their current browser version they are using is not in our list of "ideal" browsers we want to display a message.

What is the best way to check a specific version of the users browser. I am aware of the following using jQuery but this doesn't help with specific versions.

$(document).ready(function() {
   var b = '';
   $.each($.browser, function(i, val) {
       if (i=='safari' && val==true) { b = 'safari'; }
       if (i=='opera' && val==true) { b = 'opera'; }
       if (i=='msie' && val==true) { b = 'msie'; }
       if (i=='mozilla' && val==true) {b = 'mozilla'; }
   });

   //Do Something With b, Like $('#dis').html(b);
}); 

We want to be able to say is your browser Firexfox 2 or greater or IE6 or greater etc?

like image 283
Sheff Avatar asked Jul 16 '26 16:07

Sheff


2 Answers

Here is a JQuery plugin that'll help

like image 112
SquidScareMe Avatar answered Jul 18 '26 05:07

SquidScareMe


Also check for $.browser.version in the docs.jquery.com

It can return 2.0 for Firefox 2.x.x, check the docs :)

like image 21
Ricardo Vega Avatar answered Jul 18 '26 05:07

Ricardo Vega