Chapter 5. Browser Feature Detection

Introduction

Perhaps the greatest challenge that faces any web author who needs scripting or Dynamic HTML features embedded within content is how to select features that work with the widest set of browsers for the target audience. Despite claims of compatibility with industry standards, every browser is guilty of one or more of the following charges:

  • It implements some features in a peculiar way.

  • It offers its preliminary vision of proposed standards.

  • It includes proprietary features never intended for the standards track.

From an authoring standpoint, the most dramatic changes to browser functionality from version to version tend to be in two areas: the core JavaScript language (covered in Chapter 1 through Chapter 4) and the document object model (the “things” you manipulate on the page using the JavaScript vocabulary). After several years of rapid escalation of the browser feature wars among major brands, the dominant browser—Internet Explorer for Windows—remained stagnant after IE 6’s final release in October 2001. Given that almost nothing in the way of scriptable improvements arrived with IE 7 in late 2006, this period of IE stability continues. Unfortunately for developers, however, the IE 6 implementation failed to support several key W3C DOM standards, most annoyingly, the event model. In the meantime, other browsers, including Mozilla-based browsers (Firefox is the most popular), Apple’s Safari, and the cross-platform Opera browser, continued ...

Get JavaScript & DHTML Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.