W3C home > Mailing lists > Public > w3c-wai-gl@w3.org > October to December 2003

HTML techniques - Anchors and targets (possible blocker)

From: Yvette P. Hoitink <y.p.hoitink@heritas.nl>
Date: Fri, 31 Oct 2003 16:49:44 +0100
To: <w3c-wai-gl@w3.org>
Message-Id: <E1AFbWy-0004rT-HO@smtp5.home.nl>

In the HTML techniques document, there is a section about not opening
windows without informing the user:

However, the example uses the target-attribute, which is not allowed anymore
in HTML 4.0 strict and XHTML 1.0 strict. This will be confusing for people
using strict HTML, since this example leads to invalid HTML then.

I think there should be at least one example of how to open a document and
warn about that when using strict instead of transitional HTML. The only way
(at least, to my knowledge) to automatically open new windows when using
strict HTML is by using Javascript. However, you want to avoid giving
warnings about opening new windows if people have Javascript disabled. 

Whenever I wish to open a hyperlink in a new window, I use the following

<a href="http://www.w3.org"
es,menubar=yes,scrollbars=yes,resizable=yes'); return false" 
onkeypress="this.onclick();">World Wide Web Consortium</a>
<script type="text/javascript">
document.write("(opens new window)") 

The href-attribute of the A is the only location that has the actual link,
so automatic link checkers still work. If Javascript is enabled, then
clicking the link will invoke the onclick method, which will open the link
in a new window. To assure that this functionality is available for keyboard
users as well, the onkeypress event calls the onclick event (this avoids
duplication of code). After the link, Javascript is used to print the
warning about the new window, so only when the link is opened in a new
Window (i.e. when Javascript is enabled), the warning is given.

Yvette Hoitink
CEO Heritas, Enschede, The Netherlands
Received on Friday, 31 October 2003 10:52:43 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 16 January 2018 15:33:46 UTC