W3C home > Mailing lists > Public > www-validator@w3.org > June 2004

RE: target in xhtml11

From: Allan Smith <webmanager@telfordsteamrailway.co.uk>
Date: Mon, 14 Jun 2004 14:25:35 +0100
To: www-validator@w3.org
Message-id: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAvVxbyyf3JE26+CwwSDoAn8KAAAAQAAAAWfgzC+oW9EKFo0Ru89JqOgEAAAAA@telfordsteamrailway.co.uk>

Re option 2 - javascript
The suggested code obviously works

But then creates a problem when validating with WCAG / Bobby etc  along the
lines of
... Find a way of doing this that does not use a mouse.. (my words)
and adding an 'onkey' doesn't stop the validation fail

Allan Smith

-----Original Message-----
From: www-validator-request@w3.org [mailto:www-validator-request@w3.org] On
Behalf Of Beton, Richard
Sent: 14 June 2004 14:15
To: dekoder@z.pl; www-validator@w3.org
Subject: Re: target in xhtml11


Piotr 'dekoder' Rybałtowski wrote:

>Hello!
>
>Sience there's no target attribute in xhtml 1.1 what can I use to get
>target="_blank" effect known from html and xhtml transitional? Only
>javascript can help?
>  
>

Some options:

1. Use XHTML 1.0

2. Use Javascript

3. Make up your own DTD based on XHTML 1.1 modularisation

4. Don't use target at all.

To pick up 4 first, there's a school of thought that opening new windows 
is considered unkind to the user.  I'm not sure what I think of this, 
having read arguments for and agains this premise. On my own website, I 
have gradually reduced, but not eliminated, the new-window opening, but 
I may do so at some future date..

Option 3 may be the glitzy new way forward, but I worry that it may open 
a can of worms of incompatibilities so I wouldn't recommend it just 
yet.  [for the curious, I had a play with it: see 
http://www.whr.co.uk/dtd/xhtml11+target.dtd for my attempt].

Option 1 - I wouldn't recommend a backward step like this, but it is one 
of the options.
I have to confess I don't understand why many experts say don't use 
XHTML1.1 (some people even deprecate XHTML completely). This seems to me 
like saying that we shouldn't use new standards just because one popular 
browser doesn't support them yet. As it happens, IE happily pretends 
XHTML is HTML so that's good enough for me. As long as you use text/html 
(here's another can of worms).
I digress...

Finally, option 2: I have picked up bits of Javascript and what follows 
is I think a reasonably robust way to do it. Firstly the script:

/* open a new window - normal decoration (by R.D.Beton)
 * This replaces the target attribute removed from XHTML 1.1. */
function wOpen (url, name)
{
  w = window.open (url.href, name, 
"directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,statu
s=yes,toolbar=yes");
  w.focus();
  return false;
}

wOpen returns false just for the convenience of the call. And now the 
call itself:

<a href="http://www.w3.org" onclick="return wOpen(this, 
'_blank')">W3.org</a>

Note that the href attribute supplies the URL which the Javascript 
uses.  If Javascript is disabled, the normal href works instead, i.e. 
replacing the current window rather than opening a new one.

I'll end by repeating my nervousness about opening new windows and 
recommend you try reading up before deciding what to do (e.g. 
http://www.tiffanybbrown.com/articles/viewarticle.php/58, 
http://www.classy.dk/log/archive/000870.html)

Rick
http://www.whr.co.uk/



-- 

Visit our website at www.roke.co.uk

Roke Manor Research Ltd, Roke Manor, Romsey, Hampshire SO51 0ZN, UK.

The information contained in this e-mail and any attachments is confidential
to
Roke Manor Research Ltd and must not be passed to any third party without
permission. This communication is for information only and shall not create
or
change any contractual relationship.
Received on Monday, 14 June 2004 09:26:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:14 GMT