Professional JavaScript | 39 | WebReference

Professional JavaScript | 39

current pageTo page 2To page 3
[next]

Professional JavaScript

Browser Compatibility

If Internet Explorer and Netscape browsers were identical, scriptwriters would be saved a lot of worry. With increased support for standards, the differences when scripting basic tasks are becoming smaller and smaller, but still one has to be wary. Here we review versions and discuss strategies for handling differences.

Mainstream Browser Version Review

A mainstream browser is just one with a big share of the market. At August 1999, choosing a mainstream browser means choosing between Internet Explorer 4.0 or 5.0 and Netscape Navigator or Communicator 4.0 or 4.5 or 4.6. According to the Mozilla Website, version 5.0 of the Mozilla browser, which is Communicator 5.0, will be released around the end of 1999.

Even within just one of the two major vendors, there are plenty of subtleties between versions, so let's briefly recap the versions and any broad JavaScript differences that might apply.

Navigator and Communicator Versions

The original Netscape 1.0 browser was based on the Mosaic browser developed by the academic and research community. It had no JavaScript support.

Netscape introduced JavaScript with version 2.0 of the Navigator product. There was no Communicator. With that release the core language and common host objects in the browser took on the basic form that they have kept ever since. However, many tiny features were changed in subsequent releases, and version 2.0 is just a memory now. This version of JavaScript was labeled 1.0.

Version 3.0 of Navigator cleaned up the language and slightly enhanced the browser object model from 2.0, establishing a de facto standard for the JavaScript language. This version was used as the basis of the ECMAScript standard, although this browser never complied with that standard. The version was labeled JavaScript 1.1.

The basic set of browser objects and events made available in 3.0 was significant because it is the minimal set that a browser can implement in order for its JavaScript support to be of basic use. This is still important because it is to this level that most of the more obscure browsers attempt to support JavaScript. It is also important because sticking to this limited set of features is a useful way of ensuring that Web pages stay simple enough that the blind and other disabled folk can still make use of the Web. Of course, the HTML as well as the JavaScript must be sympathetically designed for the pages to be sensible.

Netscape 4.0 introduced Communicator as the first non-free browser, and a free version of Navigator. The browser was becoming quite large. With the earliest versions of 4.0, such as 4.01, the free Navigator client did not have e-mail support, which was decried by the public, and soon changed with a new minor release. Communicator was subsequently declared free as well. Important JavaScript innovations for this version involved HTML+JavaScript support in mail and news items, and JavaScript support for stylesheet objects. This version of JavaScript was labeled 1.2.

With this release, Netscape started to slip behind Internet Explorer in functionality. The way the browser processed HTML made it hard for the Netscape programmers to provide full support for Dynamic HTML, and an unusual processing innovation in the event model failed to take off. Version 5.0 removes both these obstacles. The tiny increments in version, such as 4.01 and 4.02 mostly reflect security fixes that forced a new browser release.

Netscape 4.06 was an important minor version. There were new features released, such as ECMAScript standard compliance fixes in the JavaScript interpreter, and access to new objects such as document.crypto. This version was labeled JavaScript 1.3.

Simultaneously with 4.06, Netscape released version 4.5, again with JavaScript 1.3, but the primary difference between 4.5 and 4.0 was the bundling of MacroMedia Flash with the installation plus some support in e-mail for IMAP and LDAP protocols. These enhancements continued through 4.6 and onwards, but there was no change to the JavaScript language, and only a little to the objects it could access.

4.0 and 4.x versions continue to be released in minor versions that contain bug fixes only - at the time of writing 4.08 and 4.61 are the latest versions.

Internet Explorer Versions

If Internet Explorer 1.0 and 2.0 existed, they were lost in the hysteria surrounding Netscape. There was no JavaScript support in those versions.

Internet Explorer 3.0 was released in great haste, and it showed. Its JavaScript support, available for the first time, was labeled JScript 1.0 and was awful, especially for event handling. It was rapidly followed by 3.01 and 3.02, the latter of which contained JScript 3.0. By that stage, the JScript language was in good order, but the events and objects in the browser still weren't. Internet Explorer 3.0 tried to meet the Netscape 3.0 level of JavaScript functionality, very roughly. JScript could be upgraded separately via a Web download, which created all kinds of configuration confusion for some. In typical Microsoft style, those early versions have disappeared without a trace from the Microsoft Web sites.

With Internet Explorer 4.0, Microsoft exceeded Netscape's functionality (and browser size). The primary enhancement was good Dynamic HTML support - access to all the objects making up an HTML page from JavaScript. With JScript 5.0 and WSH released separately (JScript 4.0 only appeared in a particular commercial product bundle), Microsoft was first to claim ECMAScript functionality in a browser, and first to provide a browser that could also be used as a software object from a programming language. JScript 5.0 also was first to provide exception handling functionality.

The event model in IE 4.0 has been adopted by the Web standards body, W3C for the DOM - the Document Object Model Standard. Other features of IE4.0 also influenced standards such as HTML 4.0 and related stylesheet standards.

With the 4.0 browser, Microsoft caught up with Netscape in terms of browser market share. Around the time of this release, JavaScript in the form of JScript also achieved the status of a general scripting language on the Windows platform, although not as functional or as thoroughly supported as the mighty Visual Basic, or its cut-down version VBScript. Microsoft also released a service pack, IE4.0 SP1 for the browser, bringing the final 4.0 version to 4.01.

Microsoft continues to blur the line between a browser, an operating system with a graphical interface, and a set of development components with the release of Internet Explorer 5.0. In order to be sure of having an exact version of Internet Explorer, one must now have full configuration control over the MS-Windows installation, as the functionality between the browser and the operating system rely on many common elements. JavaScript's access to many Windows-related features new in IE5.0 is no more special than any programming language used on that platform.

Contents

current pageTo page 2To page 3
[next]


Created: April 23, 2001
Revised: April 23, 2001

URL: http://webreference.com/programming/javascript/professional/chap4/6/