O'Reilly logo

JavaScript & DHTML Cookbook by Danny Goodman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. It wasn’t too many years ago that the main concerns about browser versions centered around support for “new” HTML features such as tables and frames. The situation is far more complex today. Despite claims of compatibility with industry standards, each browser implements some features in a peculiar way, may offer its vision of proposed standards, or may include proprietary features never intended for the standards track.

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). Features you commonly see in modern web pages, such as images that change color or hue when you roll the cursor over them, were not possible in the earliest scriptable browsers. Images were not yet treated as objects in the DOM, thus preventing scripts from changing the property that points to a different .gif or .jpg file for each color. Even powers that are not evident to the user, such as scripting language data types, evolve with each new browser generation. Scripting powers that an experienced programmer might assume had been ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required