[thelist] Validating JavaScript

jeff jeff at members.evolt.org
Tue Mar 13 15:32:16 CST 2001


james,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Aylard JA (James)
:
: Although there are a number of benefits to
: external script files, one potential pitfall
: is that first-generation javascript-enabled
: browsers (e.g., Netscape 2, IE 3) do not
: support them and will cough up errors when
: the page attempts to call a function or
: reference a variable that is located there.
: One simple way around at least certain aspects
: of this is to place down-level content between
: the opening and closing <script> tags for the
: first-generation browsers, e.g.:
:
: P.S. - Although this is a workaround that I
: "discovered" for myself, I think that jeff
: may have suggested it in days long past. If
: so, jeff, feel free to correct or improve upon
: anything I've written.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

the earliest record i could find:

http://lists.evolt.org/oldarchive/Week-of-Mon-19990920/004456.html

nonetheless, my suggestion is slightly different.  instead of including the
variables and functions within the same script block, you need to include
them in a script block *before* the script block that includes the external
file.  that way you can be guaranteed that those that support external files
will overwrite the first instance of the variables and functions.  this
method has been tested on every implementation i can find and has never
failed.

good luck,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org





More information about the thelist mailing list