[thelist] javascript://

.jeff jeff at members.evolt.org
Wed Jul 4 15:23:20 CDT 2001


winfried,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Winfried Huslik
:
: > syntactically correct, but hard to notice
: > the difference between it and a javascript
: > protocol that's referencing nothing.
: >
: > href="JavaScript:;"
: >
: > href="JavaScript:"
: >
: > notice the difference doesn't immediately
: > stand out.
:
: But using
:       href="JavaScript:"
: (sans semicolon) on Netscape 4 (and 6) will
: open the JavaScript Console, which is
: presumably not what you want!
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

you're quite right.  that's not what you'd want.  however, that's the point
i was trying to make.  the good link (the one with the semi-colon) doesn't
immediately appear different than one without.  so, if you were scanning
your work to make sure that none of your anchors had just "javascript:" as
the value of the href attribute, you'd be hard-pressed to do it easily.  in
contrast, if all the links used the single-line comment, that'd be obvious.

<a
 href="JavaScript://"
>blah</a>

vs

<a
 href="JavaScript:"
>blah</a>

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: I have no prove, nor did I do any testing.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ok, i thought as much.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Anyway I dared to use "javascript:;" on
: www.owad.de/wordpower.php4 which has over
: 3000 visitors daily and haven't got any
: error reports yet.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

i'm not doubting that it won't work.  my only complaint with that particular
method is it makes the code harder to maintain than using the single-line
comment.  they both accomplish the same thing and have the same universal
level of support.  one's just more apparent in the code than the other.

thanks,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list