In my current development I want to show a message if my libraries are not compatible with the browser versions. I am using axios v0.18.0, jquery v3.3.1, vuejs v2.5.17, lodash v4.17.11 and materialize v1.0.0.
IE 11 down I do not accept my code for the functions arrow (= >), when making asynchronous requests or based on promises.
Safari Not supported by vue from version 10.10 down.
Etc.
I would like in these cases (when the browser does not have support in the libraries that I use). Take a message where I recommend my users to install an updated version of their browser or use chrome or firefox.
For this I have a code that reads the browser version.
var getBrowserInfo = function() {
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');
};
let a = getBrowserInfo();
console.log(a)
But what I do not know is what message it returns when it runs, for example, in IE6 or when it runs in Safari 9.
So what I need to know is how the code will return the name of the browser to put it in my list of exceptions.