Find the browser name and version in javascript

By Santhosh N

This explains how to get the browser name and version using Javascript which is useful to display page elements accordingly to give cross browser compatibility.

Javascript has navigator object to check the browser details and following are few of the important properties whcih are useful to identify browser related details

1) navigator.appName --> This gives the browser name ("Microsoft Internet Explorer" for ex)

2) navigator.appVersion --> This gives the version of the browser ("4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; .NET4.0C; .NET4.0E)")

3) navigator.userAgent --> this gives browser agent info ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; .NET4.0C; .NET4.0E)")

Related FAQs

This is how trimming of a string can be done in javascript is simpler manner.
This is a way to check if the given string is in numeric format or not
Get the random number within the specified range
Simple statement to add a site to Favourites collection of Browser from Javascript
check the bit version of Windows you are running
You can reset all the page controls in webpage using a single statement in Javascript
Find the browser name and version in javascript  (1695 Views)