Differences between Navigator 2.0 and 3.0
Contents:
Core Language Changes
LiveConnect
JavaScript Security
Image Manipulation
The Window Object
The Location Object
Forms and Form Elements
Miscellaneous Changes
There have been quite a few changes between Navigator 2.0 and Navigator 3.0. Some of these are differences in the core JavaScript language--differences between JavaScript 1.0 and JavaScript 1.1. Others are the addition of new objects, the implementation of LiveConnect, and changed functionality in existing objects. The changes are listed below. Details can be found on the various reference entries, and in the main chapters of the tutorial.
Core Language Changes
There have been quite a few additions and improvements to the core JavaScript language, and to the way that it is embedded in HTML files:
- The
typeofandvoidoperators have been added. See Expressions and Operators. - The
constructorproperty of all objects completements thetypeofoperator as a way to determine the type of objects. (Thetypeproperty the Element object serves a similar purpose for HTML form elements). See Objects and the Object.constructor reference entry. - Constructor functions may now have a prototype object that defines methods, constants, and default properties shared by all objects created by the constructor. See Objects, and the Object.constructor reference entry.
- The String object is now a true JavaScript object, with a constructor, and a new
split()method. - The Boolean and Number objects have been added. The Number object defines several useful constants.
- The Function object now supports a constructor for the creation of "anonymous" functions. See Functions.
- The Array object provides a useful constructor for the creation of arrays, and also new
sort(),reverse(), andjoin()methods. Array handling in JavaScript 1.1 is much improved over JavaScript 1.0. See Arrays. - The
Math.random()method works on all platforms in JavaScript 1.1, and the Not-a-Number value,NaN, and theisNaN()function are implemented on all palatforms. This means thatparseInt()andparseFloat()can now correctly returnNaNto signal invalid input. - The
eval()function of JavaScript 1.0 has become a method of all objects in JavaScript 1.1. This allows JavaScript code to be evaluated in the context of any desired object. When used as a function in JavaScript 1.1,eval()will evaluate the code in the context of the current window, just as it did in JavaScript 1.0. - All objects can now be given an
assign()method, which essentially overloads the assignment operator for that particular object. See Objects. - Files of pure JavaScript code, given the .js file extension, may now be included within HTML files with the
SRCattribute of the<SCRIPT>tag. See Client-Side Program Structure. - You can specify code that requires JavaScript 1.1 and should not be run on JavaScript 1.0 platforms with the
LANGUAGE="JavaScript1.1"attribute of the<SCRIPT>tag. See Client-Side Program Structure. - JavaScript code can also be embedded within HTML tags between
&{and};using the new JavaScript entity. See Client-Side Program Structure.