1

I want to get the name of browser i am using.Currently i am trying 'navigator.userAgent' but it shows 'chrome' for both edge and chrome browser.

Manish Kumar
  • 509
  • 5
  • 15
  • **You can find the solutions on this ** [link](http://stackoverflow.com/questions/36547312/get-current-browser-name-using-jquery-code) – Himanshu Sharma Mar 21 '17 at 09:23

2 Answers2

8

This is working I am too using it .It will show perfect browser name .Here is the 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 = /*@cc_on!@*/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;
Manish Goswami
  • 863
  • 10
  • 27
0

Best way is to detect is jquery-migrate with minimum and tested code which is designed to resolve any compatibility issues before using jQuery Migrate 3.0 and upgrading to jQuery 3.0.

if($.browser.mozilla) {

} 
else if($.browser.chrome) {

} 
... go on
M Sach
  • 33,416
  • 76
  • 221
  • 314