Ryan Lin wrote:
With the XHTML Strict DTD, forcing a new window to open for a link via target="_blank" is not a valid semantic method anymore. I myself believe that whether to open in a new or current window should be user decision, not wed designer/developer. If I am using Strict DTD, the only way to achieve opening the new window is through JavaScripts.

So what argument should I give to my clients not to use target="_blank" ? If I say that won't validate your page, they won't care. So any non-technical argument that I can give to them?

That depends on the point you're trying to argue. Are you trying to argue in favour of using javascript instead of target="" to get a new window, or against the use of new windows in general? For the latter, there are plenty of arguments against using popups and I suggest you search the archives. In particular, I know I have personally refuted ever single argument for popups in the past and don't particularly feel like repeating that again.

If, however, you just want to use JS to sneak the popup past the validator, then I think you're wasting your time. If you're using popups, then getting approval from the validator is the least of your worries.

There are a wide variety of JS methods you can use to create popups, including these and their variations:

1. Using JS to add target attributes to links
2. <a href="..." onclick="window.open(this.href);return false;">
3. Using unobtrusive JS to attach event handlers to links, which call
   window.open() when activated.

Depending on the specific method used, using JS to create popups can cause numerous problems. Of those, #1 is just hiding the target attribute from the validator and basically misses the whole point of why the target attribute was forbidden in the Strict DTD. However, compared with the other 2 alternatives, it is the lesser evil.

Using the target attribute (either directly in the markup or adding it with script) is a lot more user friendly than window.open(). Firstly, it is significantly easier for a user to configure their browser to ignore target attributes, than it is to override window.open(). (Personally, I do both, but disabling window.open() has some unfortunate side effects on some sites).

The target attribute also allows the browser to notify the user that it will open a new window. Safari, for example, tells the user in the status bar when they hover over the link, and there are various other methods available for other browsers.

So the question really comes down to how important validation is to you and how much effort you're willing to put in to get the tick of approval. Although I don't recommend popups if you can avoid them, if you must use them, I recommend just using the target attribute in the markup or, if the validator's tick of approval is really that important, you can accept the fact that you're just lying to it, and if you want to put in the extra effort, then add the target attributes using script. I oppose any method that makes use of window.open().

--
Lachlan Hunt
http://lachy.id.au/


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to