Skip to main content

jQuery Check Browser Version

By Sam Deering



Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

Use jQuery to check your browser version in just a few lines of code you can optimise code for different browsers such as Firefox, IE, Safari, Chrome and more. The jQuery functions jQuery.Browser() and jQuery.Browser.Version() do all the hard work for us!

Here is how you do it.

//Example: output all version information about current browser

jQuery.each(jQuery.browser, function(i, val) {
" + i + " : " + val + "") .appendTo( document.body ); });

Example outputs:

  • Internet Explorer: 6.0, 7.0, 8.0
  • Mozilla/Firefox/Flock/Camino: 1.7.12,, 1.9
  • Opera: 10.06, 11.01
  • Safari/Webkit: 312.8, 418.9


//Example: Alerts “Do stuff for firefox 3” only for firefox 3 browsers.

var ua = $.browser;
if ( ua.mozilla && ua.version.slice(0,3) == "1.9" ) {
	alert( "Do stuff for firefox 3" );

//Example: Set a CSS property to specific browser.

if ( $.browser.msie ) {
	$("#div ul li").css( "display","inline" );
} else {
	$("#div ul li").css( "display","inline-table" );

Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

New books out now!

Learn valuable skills with a practical introduction to Python programming!

Give yourself more options and write higher quality CSS with CSS Optimization Basics.