showing results for - "version check"
Martina
13 Jun 2019
1navigator.sayswho= (function(){
2    var ua= navigator.userAgent, tem, 
3    M= ua.match(/(opera|chrome|safari|firefox|brave|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
4    if(/trident/i.test(M[1])){
5        tem=  /\brv[ :]+(\d+)/g.exec(ua) || [];
6        return 'IE '+(tem[1] || '');
7    }
8    if(M[1]=== 'Chrome'){
9        tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
10        if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
11    }
12    M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
13    if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
14    return M.join(' ');
15})();
16
17console.log(navigator.sayswho); // outputs: `Chrome 62`
similar questions
check angular version