spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / javascript / diaries / 10

[next]

Web Project Manager
Aquent
US-PA-Collegeville

Justtechjobs.com Post A Job | Post A Resume
Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

The JavaScript Diaries: Part 10

  1. Introduction
  2. Data Types & Variables
  3. Operators
  4. Functions
  5. Conditional Statements and Loops
  6. Objects
  7. Browser-Based Objects
  8. Window Methods
  9. Window Event Handlers
  10. Navigator, Screen, History and Location Objects
  11. Arrays: Part 1 - Introduction
  12. Arrays: Part 2 - Multiple Array Types
  13. Arrays: Part 3 - Array Properties and Methods
  14. The Math Object
  15. The Date Object

By 

There are four objects that provide information about the environment of the user's system. They belong to the window object: navigator, screen, history and location. These objects are used to obtain information such as screen size and resolution, color depth of the monitor, limited information on the browser history, and the URL. In addition, information such as the user's operating system, including the browser type, version and language can also be obtained.

In this installment, we'll look at objects, their related properties and methods. We'll delve deeper into them when we use them later in our study.

The navigator Object

This object is used to obtain information about the type of browser being used to access the page. It's usefulness becomes apparent when the user needs to be directed to a different page or perform certain tasks, depending upon their browser:

Properties
appCodeName
appName
appVersion
cookieEnabled
platform
userAgent

Properties

appCodeName

This property returns the internal name of the browse, but it's not really useful as it always returns Mozilla in Firefox, Netscape, IE, and Opera browsers.

appName

This property returns the 'official' name of the browser. IE returns Microsoft Internet Explorer and Firefox and Netscape both return Netscape. Since Opera users can change their browser's identity, it may appear as Netscape, Opera, or Microsoft Internet Explorer.

appVersion

This property returns the version number of the browser. However, it's not necessarily the actual version number, but an internal number. For instance, IE versions 4-6 are all shown as version 4.0 and Netscape 6 returns a version number of 5.0. In my version of Firefox, running browser version 1.07, it returns 5.0. That's because it's using the same Mozilla engine as Netscape. In addition, it may also return the operating system and the default language of the browser.

There are better ways of determining the version number. One way is to use object detection. We'll look at this and other methods later in this series.

cookieEnabled

This property is used to check if the browser will accept cookies. It could be used as follows:

if (navigator.cookieEnabled) {
  // code for cookie here
}

platform

This property returns the operating platform on the user's computer. It might look something like "Win32" or "MacPPC." It doesn't give the version of the operating system.

home / programming / javascript / diaries / 10

[next]

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Symantec Whitepaper: Converging System and Data Protection for Complete Disaster Recovery
Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
  Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Symantec Whitepaper: Comprehensive Backup and Recovery of VMware Virtual Infrastructure
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Fixing MySQL Replication · Firewall Guide: First Steps to Securing the Enterprise · VoxOx Tames the Tumultuous Communications Tangle

Created: October 14, 2005

URL: