I've recently changed a link on a site to open in the same window as the target is not allowed any more, according to the Xhtml Validator over at the W3C.
How would you target a new browser window, especially a pop-up or a new window, without using a Target="_blank" attribute?
Cheers in advance for help.
this is how i do it....
<a href="http://google.com/" onClick="window.open(this.href, 'popupwindow', 'width=400,height=300,scrollbars,resizable'); return false;">Click me, fool.</a>
Re: this is how i do it....
<a href="http://google.com/" onClick="window.open(this.href, 'popupwindow', 'width=400,height=300,scrollbars,resizable'); return false;">Click me, fool.</a>
Not is practical, this way is better (for me)

http://www.sitepoint.com/article/standards-compliant-world
Basically use it a .js file and a reference this:
<a href="document.html" rel="external">external link</a>
Target="_blank" and still xHtml (strict) Valid?
All all of that does is lets your code validate and then butcher it via JS to have a "target" attribute when the page is viewed. Very naughty, don't like that at all. Having a window.open in the function that they give would be better, but is still a bit gash imo.
Target="_blank" and still xHtml (strict) Valid?
papa - Thanks for the reply, but I'm not trying to understand the opening of new pop-up windows (maybe I didn't explain enough), but how to target them without using the target attribute.
man26 / Seb Just read the article. For all the effort it seems easier to simply go back to transitional.
It seems a little backward to say the least. It makes sense for people on PDA's, where new windows aren't possible, but surely, especially given the tabbed browsing now being introduced by mozilla, the standard would maybe move towards something like "_NewTab" or "_ThisTab" .
In the whole company where I work I think there are only 4 out 100 or so people that are actually aware that a CTRL+Click opens a new tab on a link in FireFox, or that a Shift+Click gives a new window in most browsers.
Blargh..
I'd better get playing with the .js then. ;p
Target="_blank" and still xHtml (strict) Valid?
You can actually add 'target' back into your dtd
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/DTD/xhtml11.dtd" [ <!ATTLIST a target CDATA #IMPLIED > ]> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <meta http-equiv="Content-Type" content="text/xml; charset=UTF-8" /> <title> New Document </title> </head> <body> <div> <a href="anotherwindow.html" target="_blank">a link in another window</a> </div> </body> </html>
This is a perfectly legal way to add to the attribute list of an existing tag.
The w3c validator will accept this as valid XHTML1.1 (but even the validator is not perfect. If you remove the <div> </div> it will not validate). :roll:
The downside is that there is a known bug in IE such that the closing '>] 'brackets will be printed on the page. Oh well, you can't have it all.