Javascript Navigator userAgent

by top54u.com 18 Jul, 2008
Spotlight.....

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:

Output: 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:

Output: 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

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

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

8/23/2008 8:41:15 PM

OUR SPONSORS[+ advertise here]
related videos.....
recent posts.....
top54u ezines.....