This question already has an answer here:
- How can you detect the version of a browser? 23 answers
How do I determine the exact browser and version using JavaScript?
This question already has an answer here:
How do I determine the exact browser and version using JavaScript?
Note, however, that both will not necessarily reflect the truth. Many browsers can be set to mask as other browsers. So, for example, you can't always be sure if a user is actually surfing with IE6 or with Opera that pretends to be IE6.
Not exactly what you want, but close to it:
The variables will contain the appropriate version or
false
if it is not available.I'd appreciate it if someone using Chrome could find out if you can use
window.chrome
in a similar way towindow.opera
.With jQuery:
gives you somthing like:
Here's how to detect browsers in 2016, including Microsoft Edge, Safari 10 and detection of Blink:
The beauty of this approach is that it relies on browser engine properties, so it covers even derivative browsers, such as Yandex or Vivaldi, which are practically compatible with the major browsers whose engines they use. The exception is Opera, which relies on user agent sniffing, but today (i.e. ver. 15 and up) even Opera is itself only a shell for Blink.
This is what I'm using:
info
properties:browser
:gc
for Google Chrome;ie9
-ie11
for IE;ie?
for old or unknown IE;ed
for Edge;ff
for Firefox;sa
for Safari;op
for Opera.os
:mac
win7
win8
win10
winnt
winxp
winvista
linux
nix
mobile
:a
for Android;i
for iOS (iPhone iPad);w
for Windows Phone;b
for Blackberry;s
for undetected mobile running Safari;1
for other undetected mobile;0
for non-mobiletouch
:true
for touch enabled devices, including touch laptops/notebooks that has both mouse and touch together;false
for no touch supporttablet
:true
orfalse
https://jsfiddle.net/oriadam/ncb4n882/