spacer

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

home / programming / javascript / designing / chap6 / 1 current pageTo page 2To page 3To page 4
[next]

Designing with JavaScript, 2nd Edition

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

What browser is that knocking at my door?

Before you learn how JavaScript differentiates between one browser and another, you need to understand how JavaScript gets information from the browser. This applies to both Netscape Navigator and Internet Explorer.

The navigator object

  The navigator object provides information about the browser, regardless of whether the browser is Netscape Navigator, Internet Explorer, or any other browser.

JavaScript identifies browsers through the navigator object. Although "navigator" is the name of Netscape's browser, it serves the same function in IE's implementation of JavaScript. You can get a lot of information from the navigator object, and we'll cover it all in this chapter. Table 6-1 shows three of the more useful properties for getting information about browsers, versions, and operating systems.

Property What it refers to
navigator.appName The browser's name
navigator.appVersion The browser's version
navigator.userAgent The browser's "user agent"--the official term for a web browser or a web-capable reader, like a handheld device or WebTV

Table 6-1: Properties of the browser object

Without any context, the significance of these properties may not be clear. Table 6-2 shows some examples of what you actually get when you use these properties on different browsers. Note that this list isn't comprehensive; it just shows the properties for a handful of configurations, including some that are mostly of historical interest.

Browser appName appVersion userAgent
Netscape 3.01 on a Mac Netscape 3.01 (Macintosh; I; PPC) Mozilla/3.01 (Macintosh; PPC)
Netscape 4.0 on Windows 95 Netscape 4.0 (Win95; I) Mozilla/4.0 (Win95; I)
Netscape 4.72 on Windows 98 Netscape 4.72 [en] (Win98; U) Mozilla/4.72 [en] (Win98; U)
Netscape 6.01 on Windows Me Netscape 5.0 (Windows; en-US) Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; m18) Gecko/ 20010131 Netscape6/6.01
Internet Explorer 3.0 on Windows 95 Microsoft Internet Explorer 2.0 (compatible; MSIE 3.01; Windows 95) Mozilla/2.0 (compatible; MSIE 3.01; Windows 95)
Internet Explorer 4.0 on Windows 95 Microsoft Internet Explorer 4.0 (compatible; MSIE 4.0; Windows 95) Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)
Internet Explorer 5.0 on a Mac Microsoft Internet Explorer 4.0 (compatible; MSIE 5.0; Macintosh; I; PPC) Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
Internet Explorer 5.5 on Windows Me Microsoft Internet Explorer 4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90) Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)
Internet Explorer 6.0 on Windows 2000 Microsoft Internet Explorer 4.0 (compatible; MSIE 6.0; Windows NT 5.0) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Table 6-2: Navigator properties on different browsers


home / programming / javascript / designing / chap6 / 1 current pageTo page 2To page 3To page 4
[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: December 12, 2001
Revised: December 12, 2001


URL: http://webreference.com/programming/javascript/designing/chap6/1/