Skip to content

Instantly share code, notes, and snippets.

@dstyle0210
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save dstyle0210/de2bb9a7d62d8e1482e4 to your computer and use it in GitHub Desktop.

Select an option

Save dstyle0210/de2bb9a7d62d8e1482e4 to your computer and use it in GitHub Desktop.
[동작확인필요함] $.browser 생성.
$.extend({
// jquery 브라우저 구분 코드 (jquery 1.8.3 버전의 jQuery.broswer)
// 아래의 코드가 필요하면 자신의 클래스에 붙여서 사용하면됨~!
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
browser : (function(){
function uaMatch( 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 );
var browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
return browser;
})()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment