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

On Tuesday, February 19, 2002, at 09:38 AM, Jim Ley wrote:

> "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
> the
>> 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.

Script is now updated to confirm whether window was spawned before 
returning false. Limited testing suggests viability - want to throw 
your worst at it?

>> 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.

Can you give me a chapter-and-verse on that? I can't find such a 
prohibition. Even if there exists such a reference, I'll need 
further convincing that, given the full context, its author(s) 
would stand by it. Of course, opening new windows at all ("until 
user agents" yadda yadda) is a violation, so we're probably moot.

>   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.

I think you are too ready to ascribe godlike qualities to human 
spec/guideline authors.

ps: I didn't see this reply at first; sorry about my subsequent 
suggestion to "read the thread", Jim.

Received on Friday, 22 February 2002 16:06:29 UTC