var Sys = Sys || {};
Sys.browser = Sys.browser || function (w, d, n)
{
var u = n.userAgent.toLowerCase(),
browser = {};
browser.u =
u;
browser.render = d.compatMode;
if (n.product ===
‘Gecko‘)
browser.gecko = true;
if (/
applewebkit\/(\d+\.\d+)/i.test(u))
browser.webkit = RegExp[‘\x241‘];
if
(!!w.ActiveXObject || "ActiveXObject" in w) {
browser.ie = /msie
(\d+\.\d+)/i.test(u) ? RegExp[‘\x241‘] : d.documentMode;
if
(/\s+trident\/?(\d+\.\d+)?/i.test(u))
browser.trident =
RegExp[‘\x241‘];
browser.quirks = (d.compatMode ==
‘BackCompat‘);
browser.norm = d.documentMode;
return
browser;
}
if (browser.gecko && /firefox\/(\d+\.\d+)/i.test(u))
{
browser.firefox = RegExp[‘\x241‘];
return browser;
}
if
(/chrome\/(\d+\.\d)/i.test(u)) {
browser.chrome =
RegExp[‘\x241‘];
return browser;
}
if (browser.gecko &&
/\s+safari\/?(\d+\.\d+)?/i.test(u)) {
browser.safari =
RegExp[‘\x241‘];
return browser;
}
if (!!w.opera &&
/opera(?:\/| )(\d+(?:\.\d+)?)/i.test(u)) {
browser.opera =
RegExp[‘\x241‘];
if
(/\s+presto\/?(\d+\.\d+)?/i.test(u))
browser.presto =
RegExp[‘\x241‘];
return browser;
}
return browser
}
(window,
document, navigator);
原文地址:http://www.cnblogs.com/imwanghy/p/3755149.html