W3C home > Mailing lists > Public > www-validator@w3.org > February 2002

Re: opening a link in a new window (hope this is ok for this list)

From: Jim Ley <jim@jibbering.com>
Date: Tue, 19 Feb 2002 17:38:58 -0000
Message-ID: <000d01c1b96c$56737be0$ca969dc3@emedia.co.uk>
To: <www-validator@w3.org>
"todd fahrner" <fahrner@pobox.com>
> On Monday, February 18, 2002, at 09:15 , Liam Quinn wrote:
> I lost the 'let the user decide' argument a while back in one of my
> projects, but also wanted to avoid 'target'. I asked a knowledgeable
> associate for the best javascript approach; i.e., one that preserves
> integrity of the link w/o javascript, minimizes script clutter in html,
> etc. He cooked up this, a close variant of which I've now got in a
> linked script for site-wide availability:
> <http://glish.com/misc/fahrner.html>.

A few notes on it:

It won't work in a large number of browsers (the link will become a dead
no-operation) - this is because window.open does nothing, but the return
false succeeds, example browsers , pocket IE, AvantGo always, Mozilla,
IE, Opera under configuration, other browsers will just error and may
well recover to navigate to the url.

> There's one bit of 'target' functionality that this script fails to
> capture: the spawned window can get lost behind others. After the
> initial load, subsequent ones fail to focus the target. Neither my
> associate nor i could come up with an elegant, cross-browser means of
> achieving this. We resort, inelegantly, to sticking
> onload="self.focus()" in the body of all of the targeted documents. If
> you want to link to docs that you don't control, you are out of luck.

and self.focus() is not a solution in many scenarios, and is a WCAG 1.0 A
violation, so is clearly not an option.  There's no reliable method that
provides reliable fallback without the target attribute, and the failure
scenarios are IMO serious enough that you just can't do it.  Still if
it's not in standard, it's surely not there for a reason, subverting that
with script just can't be sensible.

Received on Tuesday, 19 February 2002 14:40:19 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:32 UTC