如何使用jQuery或JavaScript获取浏览器名称?
答
这是工作,我也用它。它将完美展现浏览器名称。这里是demo
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// At least Safari 3+: "[object HTMLElementConstructor]"
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// Internet Explorer 6-11
var isIE = /*@[email protected]*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
// Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;
// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;
+0
曾任职对我也是。感谢很多。 –
答
最好的方法是检测是jquery-migrate最小和测试,其目的是解决任何兼容性代码使用jQuery Migrate 3.0并升级到jQuery 3.0之前的问题。
if($.browser.mozilla) {
}
else if($.browser.chrome) {
}
... go on
**你可以找到这个解决方案** [链接](http://*.com/questions/36547312/get-current-browser-name-using-jquery-code) –