Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

The Navigator Object

The navigator object can be used to report information about the user's web browser and what computer or device they are using to visit your website. Shown below are some of the most useful navigator object properties.

Property Description
appCodeName code name of browser
appName browser name
appVersion browser version
cookieEnabled are cookies enabled?
platform computer or device
userAgent information about itself browser sends to website

Shown below is code that displays some of the navigator object property values in a message box.

<script type="text/javascript">

txt = "Browser CodeName: " + navigator.appCodeName + '\n';
txt+= "Browser Name: " + navigator.appName + '\n';
txt+= "Browser Version: " + navigator.appVersion + '\n';
txt+= "Cookies Enabled: " + navigator.cookieEnabled + '\n';
txt+= "Platform: " + navigator.platform + '\n';
txt+= "User-agent header: " + navigator.userAgent + '\n';


Using Navigator User-agent Property to Detect Mobile Devices

Because mobile devices have only a small screen some websites redirect their webpage requests to a webpage specialy designed for small screens. Shown below is code that examines the navigator object's user-Agent property to detect some mobile devices and redirect the web browser.

<script type="text/javascript">

if ((navigator.userAgent.match(/iPhone/i)) ||
(navigator.userAgent.match(/Android/i)) ||
(navigator.userAgent.match(/Windows Phone OS 7/i)))


The code uses regular expressions to find mobile devices names in the user-Agent string. The i option means the expression is case-insensitive.

There are many more user-Agent properties than listed here, but there is no standard as to which ones are available in different browser versions, and the data contained in the properties is also unreliable.

More Java Script Code:
• Using the Java Script eval() Function
• JavaScript .big and .small to Change Text Size
• The switch / case Structure
• Window onload Event
• Generating Random Numbers
• The Navigator Object
• Java Script Events
• Java Script Character Encoding and Decoding
• Java Script Arithmetic Operators
• Window Object Properties and Methods

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2024 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268