20.1. Platform and Browser Compatibility

When developing production-quality
JavaScript code, testing and knowledge of platform-specific,
vendor-specific, and version-specific incompatibilities are your
chief allies. If you know, for example, that Netscape 2 on Macintosh
platforms always gets the time wrong by about an hour, you can take
steps to deal with this problem. If you know that Netscape 2 and 3 on
Windows platforms do not automatically clear your setting of the
status line when the mouse moves off a hypertext link, you can
provide an appropriate event handler to explicitly clear the status
line. If you know that Internet Explorer 4 and Netscape 4 support
vastly different Dynamic HTML models, you can write pages that use
the appropriate mechanism depending on the browser in use.

Knowledge of existing incompatibilities is crucial to writing
compatible code. Unfortunately, producing a definitive listing of all
known vendor, version, and platform incompatibilities would be an
enormous task. It is beyond the scope and mission of this book, and
it has apparently never even been seriously attempted. You may find
some assistance on the Internet, but you will have to rely primarily
on your own experience and testing. Once you have identified an area
of incompatibility, however, there are a number of basic approaches
you can take to coping with it, as described in the following
sections.