W3C home > Mailing lists > Public > w3c-wai-gl@w3.org > July to September 2004

Re: [#1059] Prohibit URLs with javascript protocol

From: Martin Honnen <Martin.Honnen@gmx.de>
Date: Wed, 22 Sep 2004 14:47:49 +0200
Message-ID: <41517475.5070306@gmx.de>
To: w3c-wai-gl@w3.org

Michael Cooper wrote:

> The following is a proposal for HTML techniques. 

> Links that use the Javascript protocol, e.g.,
> <a href="javascript:dosomething();">Javascript link</a>
> are unusable by browsers that do not support javascript.
> There should be a technique that advises authors not to use
> javascript links. Instead, they should provide an http link to a
> fallback page, and instantiate the desired script using event
> handlers. For example:
> <a href="fallback.html" onactivate="dosomething()">Good link</a>

Neither HTML 4.01 nor XHTML 1.0 know an onactivate event handler thus I
don't think what you suggest as an alternative fits into a proposal for
HTML techniques.
IE 5.5 and IE 6 on Win do support an onactivate event handler, see
but that has a different semantic, it doesn't fire when you follow the
link but instead fires when you navigate to the link.
Thus I don't think it makes sense to suggest scripters to replace
   <a href="javascript:dosomething();">Javascript link</a>
   <a href="fallback.html" onactivate="dosomething()">Good link</a>
you need to suggest something that is functionally equivalent which would be
   <a href="fallback.html"
               if (event.preventDefault) {
               return false;">Good link</a>
where the script code

              if (event.preventDefault) {
               return false;

is necessary to prevent the browser from loading the fallback.html when
the dosomething() call works.


	Martin Honnen
Received on Wednesday, 22 September 2004 12:48:29 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 16 January 2018 15:33:51 UTC