Richard's JavaScript Tutorials

Updated 07/18/14

Home
Animation
precachedImages
digitalClock
Object Tag (Audio)
Cookies.htm
Math_Object
Using CSS
The Style Object
Client_Info
customObject
functions
UsingArrays
comments
concatenation
documentwrite
ifelse
Loops
forms
Strings
variables

 

Using the navigator object to detect client information

In this section I'll demonstrate a very simple script that will detect some client information like, if the user has cookies enabled and the browser type.

 

<html><html> <head>
<script language = "JavaScript"> <!--

function infoBrowser( )
{
self.document.write(" The browswer name is = " + navigator.appName + " " + "\n")
self.document.write("\n" + "Cookies enabled = " +navigator.cookieEnabled+ "")
self.document.write("\n" + "The Clients Platform is = " + navigator.cpuClass+ "")
self.document.write("\n" + " The Users PC is a " + navigator.userAgent)
}

//--> </script></head> <body>
<script language= "JavaScript"> <!--
infoBrowser( )
//--> </script> </body> </html>

This is a simple script appName gives the application name,
userAgent give some info about the clients cpu, navigator.cookiesEnables is to display if the users cookies are enabled or not. Here is the script in action below:

 


Now try creating your own script using the navigator object to detect client information. If you have any questions about this or any other script on this site. Contact me at webmaster@cayemay.com

Home | Animation | precachedImages | digitalClock | Object Tag (Audio) | Cookies.htm | Math_Object | Using CSS | The Style Object | Client_Info | customObject | functions | UsingArrays | comments | concatenation | documentwrite | ifelse | Loops | forms | Strings | variables

This site was last updated 07/18/14