Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, PHP, and whatever else I happen to feel like hacking at.

Javascript: The Definitive Guide

Jerry Stratton, August 2, 2001

I’ve seen “free” web sites that would open two web pages on entering their page, and then try to open web pages on leaving their site as well! Because of this, many people—justifiably—turn off Javascript alltogether. It’s easy enough to do, it just requires going into a browser’s preferences and turning off “Javascript” or “ECMAScript”. Presto! No more annoying pop-ups. Unfortunately, it also turns off useful Javascripts; smart web designers will design their pages so that users will still get basic functionality, but some of the ease-of-use features, or features that require a scripting language, will be lost to those readers.

I’m seeing new browsers with the ability to turn off only certain parts of Javascript. On the Macintosh, for example, the iCab browser allows the user to forbid Javascripts from opening new windows while leaving the rest of Javascript’s functionality intact. This is a good thing, because Javascript can do some amazingly useful things, and as users are able to keep Javascript enabled while disabling its more annoying aspects, Javascript will become more and more useful.

Where Javascript excels is in making things easier for the reader. We’ve all seen web forms where, after filling out the form, the site responds that some field was left blank—and then, half the time moving back to the previous page you find that the entire form has been depopulated! Javascript allows the web designer to warn the user of possible problems with the form before the form is submitted.

For example, add the following line to a web page, in the HEAD section: