判断浏览器类型
<script type="text/javascript">
(function ($) {
var _a = window.navigator.userAgent.toLowerCase();
var isIE = _a.indexOf("msie") > -1;
var isIE6 = _a.indexOf("msie 6.0") > -1;
var isIE7 = _a.indexOf("msie 7.0") > -1;
var isIE8 = _a.indexOf("msie 8.0") > -1;
var isFirefox = _a.indexOf("firefox") > -1;
var isChrome = _a.indexOf("chrome") > -1;
var isOpera = _a.indexOf("opera") > -1;
var isSafari = _a.indexOf("safari") > -1 && !isChrome;
jQuery.MyBrowser = {
isIE: isIE,
isIE6: isIE6,
isIE7: isIE7,
isIE8: isIE8,
isFirefox: isFirefox,
isChrome: isChrome,
isOpera: isOpera,
isSafari:isSafari
};
})(jQuery)
alert(jQuery.MyBrowser.isFirefox);
</script>