[thelist] javascript://

Winfried Huslik winfried at huslik.de
Wed Jul 4 07:56:13 CDT 2001


Jeff,

On 2001-07-03 18:54 Uhr, .jeff (jeff at members.evolt.org) wrote:

>winfried,
>
>:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>: From: Winfried Huslik
>:
>: Did you ever try:
>:      "javascript:;"
>: which is a syntactically correct empty
>: statement as opposed to
>:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>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!
>
>:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>:      "javascript://"
>: which is not, but condoned by browsers
>: and sometimes irritating them.   (It calls
>: the JavaScript engine without feeding
>: anything to it exept a comment not having a
>: clearly defined end of statement (no "\r\n"
>: or ";").
>:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>what proof do you have as a basis for this opinion?  what browsers have you
>noted this causing an error in?

I have no prove, nor did I do any testing. This was just an assumption 
based on the report of:

>>.jeff mentioned this elegant hack to the HREF:
>>
>>[a href="javascript://" onCLick="verifyForm(document.FormName);" ...]
>>
>>However if my function has a .submit(), the function fails to submit. The 
>>whole function works fine (both IE and Netscape) except the submit when 
>>javascript:// is in the HREF.  If I remove the javascript:// it submits.
>>
>>Go figure. Any clues??
>>----------------------------------
>>Anthony Baratta

You are right with your comments on the
>:      a href="#"
side effects.

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.

Winfried




More information about the thelist mailing list