[thelist] XHTML 1.0 and target

Richard Harb rharb at earthling.net
Tue Aug 8 18:30:30 CDT 2006


On Tuesday 08 August 2006 23:48, Bill Moseley wrote:
> I'm working on a site that uses:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> But delivers the content as text/html.
>
> I realize it probably should be HTML 4.01 instead, but that's besides
> the point at this time.
>
> Link targets are not valid in xhtml.  There's quite a few pages about
> extending the DTD for including target, but it seems like it's not
> that well supported of a solution.  The other solution I see posted
> quite a bit is to use javascript window.open(), which I'm not very
> fond of doing.
>
> Anyone using valid XHTML 1.0 Strict and using target to popup links in a
> separate window?  What's your solution?
>
> This is for "external links" -- the client wants them to open in a
> new window.  Personally, I think it should be up to the user to
> follow links as they see fit -- I hate it when new windows open, I'd
> rather control that myself as the end user.  I might want to open it
> in a new tab, for example.

I share your views ...

That being said, for a while I've only built pages with the strict doctype and 
used the rel="external" attribute in combination with the tiny javascript 
without any problems when it couldn't be avoided.

I also like this 'hack', because modifying the behaviour of the A element is 
done with javascript - and that's how it should be anyway, right?

The nice thing about it is that the clients themselves who insist on this 
feature hardly ever have javascript disabled and thus will always have those 
links open in their favoured new window.

The script can easily be found:
http://www.google.at/search?q=target+attribute+valid+xhtml



More information about the thelist mailing list