Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
jQuery.browser support for jQuery 1.8+
JavaScript
branch: master
Failed to load latest commit information.
src initial commit
CHANGELOG.md initial commit
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.