Computer >> Computer tutorials >  >> Programming >> Javascript

How can you detect the version of a browser using Javascript?


To detect the browser version on the client machine, your script can analyze the value of navigator.appVersion or navigator.userAgent.

Example

console.log(navigator.appVersion)

Output

This will give the output based on your browser and its version −

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36