Michael Winter wrote:
Richard Cornford wrote: <a href="http://www.google.com/"
onClick="this.href =
'http://www.mypage.com/cgi-bin/count?'+
escape(this.href);">Google</a>
That is, in effect, the same as the original link the OP posted. ...
<snip>
Yes you are right, it won't behave much differently. It probably is more
reliable to let clicking on the link do the navigation rather than
scripting the - location - object, and it always makes more sense to me
to have the URL in the HREF and refer to - this.href - in the event
handlers, as that lets you use the same code for all links and not worry
about updating two URLs whenever anything changes.
I don't think there will be a way of doing what the OP wants because it
would never be possible to tell when a user of the context menu was
selecting bookmaking or opening in a new tab/window (or doing something
else entirely). It might be possible to use the mousedown event to
change the URL (in addition to onclick, to cover keyboard navigation,
and with more elaborate code to prevent preppending the URL twice) and
attempt to pick up the context menu a activity that way, but that will
end up possibly bookmaking the counter URL.
Richard.