Categories

jQuery.browser.version

Categories: Utilities | Properties of the Global jQuery Object | Deprecated

jQuery.browser.versionReturns: String

Description: The version number of the rendering engine for the user's browser.

  • jQuery.browser.version

    version added: 1.0

Here are some typical results:

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

Note that IE8 claims to be 7 in Compatibility View.

  • Returns the version number of the rendering engine used by the user's current browser. For example, FireFox 4 returns 2.0 (the version of the Gecko rendering engine it utilizes).

    HTML:
    
    <p></p>
    
    CSS:
    
      p { color:blue; margin:20px; }
      span { color:red; }
      
    Code:
    
    $("p").html( "The version number of the rendering engine your browser uses is: <span>" +
                    $.browser.version + "</span>" );
    
  • Alerts the version of IE's rendering engine that is being used:

    Code:
    
    if ( $.browser.msie ) {
      alert( $.browser.version );
    }
    
  • Often you only care about the "major number," the whole number, which you can get by using JavaScript's built-in parseInt() function:

    Code:
    
    if ( $.browser.msie ) {
      alert( parseInt($.browser.version, 10) );
    }