Re: target in xhtml11

Piotr 'dekoder' Rybałtowski wrote:

>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 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 = (url.href, name, 
  return false;

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

<a href="" onclick="return wOpen(this, 

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



Visit our website at

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:16:26 UTC