WebAIM - Web Accessibility In Mind

E-mail List Archives

RE: Best practice for warning users of opening window

for

From: Patrick Lauke
Date: Aug 12, 2005 11:12AM


> Paul Collins

> The line of code I am using is:
> <a onclick="popUp(this.href,'fixedscroll');return false;"

It shouldn't just return false. It should check whether or not a
new window popped up successfully, and only return false if that's the
case. Even in the "javascript on" scenario, a popup blocker may have
prevented the popUp function from working...if you then return
false under the assumption that it did work, you've effectively disabled
the link.

Depending on how your popUp function works, the change should just be
minimal though. Essentially, you want popUp to return whether or not
the call to window.open was successful.

function popUp(...) {
...
return window.open(...);
}

and in your link

onclick="return !popUp(...);"

Patrick
___________
Patrick H. Lauke
Webmaster / University of Salford
http://www.salford.ac.uk
___________
Web Standards Project (WaSP) Accessibility Task Force
http://webstandards.org/
___________