Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
jQuery.browser support for jQuery 1.8+
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
CHANGELOG.md
README.md

README.md

$.browser support for jQuery 1.8+

(function($) {
  "use strict";

  var matched, browser;

  // Use of $.browser is frowned upon.
  // More details: http://api.jquery.com/jQuery.browser
  // $.uaMatch maintained for back-compat
  $.uaMatch = function( ua ) {
    ua = ua.toLowerCase();

    var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
      /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
      /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
      /(msie) ([\w.]+)/.exec( ua ) ||
      ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
      [];

    return {
      browser: match[ 1 ] || "",
      version: match[ 2 ] || "0"
    };
  };

  matched = $.uaMatch( navigator.userAgent );
  browser = {};

  if ( matched.browser ) {
    browser[ matched.browser ] = true;
    browser.version = matched.version;
  }

  // Deprecated, use $.browser.webkit instead
  // Maintained for back-compat only
  if ( browser.webkit ) {
    browser.safari = true;
  }
  if ( browser.chrome ) {
    browser.webkit = true;
  }

  $.browser = browser;
})(jQuery);


Other resources

Something went wrong with that request. Please try again.