-1

I found the code detect the browser and version , but i am searching full version

Example :

navigator.sayswho= (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] || '' || tem[2]);
    }
    if(M[1]=== 'Chrome'){
        tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
        console.log("eee",tem);
        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], tem[2]);
    return M.join(' ');
})();

console.log("ddddd",navigator.sayswho);  

using above code browser and version getting, but not full version.

Chrome 70

IE 11 

how to get full version like 

Chrome 70.0.3538.102

IE 11.726.16299.0
John Ken
  • 898
  • 1
  • 13
  • 26
  • 1
    Possible duplicate of [How can you detect the version of a browser?](https://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser) – Ahmad Nov 27 '18 at 10:06
  • @Ahmad: The code in OP's "this is _not_ what I want" example looks like it is taken from your dupe suggestion's answers. – Amadan Nov 27 '18 at 10:09
  • check http://mrbool.com/how-to-detect-different-browsers-and-their-versions-using-javascript/25424 – Shiv Kumar Baghel Nov 27 '18 at 10:22
  • please check [this solution](https://stackoverflow.com/questions/11219582/how-to-detect-my-browser-version-and-operating-system-using-javascript/11219680), i tried it and it works fine for me. – Ali Aljarah Nov 27 '18 at 10:39

1 Answers1

0

If you are available to use third party JS library than you can try to make a test with Platform JS.

Example code:

<!doctype html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/platform/1.3.5/platform.min.js"></script>

<script>
console.log(platform);
document.write("You are using " + platform.name +
               " v" + platform.version + 
               " on " + platform.os);
</script>
</head>
<body>
</body>
</html>

Output with various browsers.

enter image description here

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19