Javascript Navigator userAgent property returns the combination of navigation object properties such as appCodeName and appVersion. Javascript navigator userAgent property enables you to detect the name and version of any web browser such as Microsoft Internet Explorer, FireFox, and Opera etc. userAgent property of navigator returns the semi-colon separated values of Browser Name and version, OS Platform version, .Net CLR and versions installed in windows XP and above.

Syntax for Javascript Navigator userAgent

navigator.userAgent

or

window.navigator.userAgent

You can also access the userAgent property using window.navigator in javascript code as shows in above syntax.

Example of Javascript Navigator userAgent

<script language="javascript" type="text/javascript">
    document.write(navigator.userAgent);
</script>

Above example of navigator object property userAgent returns the browser sent header information according to the client web browser used to visit the web site.

In Internet Explorer navigator.userAgent returns:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

In FireFox navigator.userAgent returns:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16

In Opera web browser navigator.userAgent returns

Opera/9.00 (Windows NT 5.1; U; en)

Continue to next tutorial: Javascript Check Cookies Enabled to learn how to detect whether cookies are enabled on web browser or not.

Recent JavaScript Tutorials

Javascript FSO ShortPath property

Javascript FileSystemObject (FSO) provides a ShortPath property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Path Property

Javascript FileSystemObject (FSO) provides the Path property that can be accessed through the file object or folder object returned by the GetFile or GelFolder method

Javascript FSO Type property

Javascript FileSystemObject (FSO) provides a Type property that can be accessed through file object or folder object returned by the GetFile or GetFolder method

Javascript FSO ShortName property

Javascript FileSystemObject (FSO) provides a ShortName property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Name Property

Javascript FileSystemObject (FSO) provides a Name property that can be accessed using file object or folder object.