function getBrowser () {
var arr = navigator.userAgent.match(/(MSIE|rv|Chrome|firefox|opera|safari)[\s:\/]?(\d+)/);
var type= {
MSIE: "ie",
rv: "ie",
Chrome: "chrome",
firefox: "firefox",
opera: "opera",
safari: "safari"
};
var result = {
browser: type[arr[1]],
version: arr[2]
};
return result;
};
网友评论