Bert Doorn wrote:
Serdar Kýlýç wrote:
How does one open a new window with a 4.01 Strict DOCTYPE and have it
be valid? For my weblog I ran the w3 validator and it complained that
there is no attribute called target

The users!  Please, won't somebody think of the *users*!

Many users hate popup windows. There are no valid use-cases or reasons for opening a popup window, don't do it. If you think you have one, I'd like to hear it, but know this: I've heard many excuses over the years (some more often than others) but every single one of them has been flawed in some way.

The main idea is that one should not open new windows at all, leaving it up to the user to decide, which is why the target attribute was removed.

Correct.

But if you want to (or "have to"), either go back to transitional or use javascript. You may find some discussions about it in the mail list archives, but the simplest implementation would go along these lines:

<a href="page.html" onclick="return !window.open(this.href)">link text</a>

That is absolutely no better than using the target attribute. In fact, for accessibility reasons, it is worse.

Good browsers, like Firefox (and probably many others), allow the user to easily disable the effect of the target attribute when it would cause a new window to open, without interfering with legitimate uses of it in frames (which are also evil). However, with window.open, the ability is not so easy. It is possible to do in Firefox. I do it myself, so that any call to window.open acts like a regular link and opens the page in the same window). However, it does have side-affects that an average user would find more difficult to cope with.

Thus, while I personally find that both the target attribute or window.open() (when used like the example above) are of little concern [1], most users wouldn't be able to override the script as easily as the target attribute. Additionally, a user stylesheet may be used to indicate the presence of the target attribute, but not of that specific type of script, and so the user has no opportunity to take further action to prevent it (if required).

Also, for those that don't know how to prevent even the target attribute from opening a new window, why should they be forced to accept them? Do you consider it a kind of opt-in/out feature, whereby unless a user explicitly requests not to see new windows, then they must be ok with them?

[1] window.close(), on the other hand, is a pain in the *** thanks to a bug in Firefox, which has only recently been fixed in the trunk
--
Lachlan Hunt
http://lachy.id.au/
******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************

Reply via email to