Re: SCR24: Using script to open a new window

On 22/05/06, Christophe Strobbe <christophe.strobbe@esat.kuleuven.be> wrote:
> the same thing but that does not open a new window if a modifier key is
> pressed while the link is clicked. See
> http://www.456bereastreet.com/archive/200605/opening_new_windows_with_javascript_version_11/

Unfortunately this is not safe nor accessible - it violates the
changing of focus without user interaction problem.

more importantly, it assumes that if there is a window.open() function
which returns an object, then a new window was successfully opened,
this is completely unsafe and absolutely untrue, the script does not
work on all current main stream default configuration UA's let alone
rarer ones. (it depends on there not being certain 3rd party
anti-virus/anti-popup tools not being present in the mainstream ones)

> Another example is 'The Perfect Pop-up' at
> http://accessify.com/features/tutorials/the-perfect-popup/
>
> We could add these to the related resources for technique SCR24.

Again, this one is not perfect, it also does not work on numerous
UA's, it makes the unsafe assumption that window.open that doesn't
error results in a new window, it simply doesn't.

The example is:
<a href="file.htm" onclick="window.open('file.htm');return false;"
target="newWin">

A better example is:
<a href="file.htm" onclick="window.open('',this.target);" target="newWin">

but even this is not perfect, there's not much better.

This of course highlights the whole baseline problem, if you say the
baseline includes script, that doesn't really help when things like
window.open are implemented in so many different ways in so many
different situations, exactly what does a baseline of "javascript"
mean w.r.t. to the simple one thing of window.open.

Cheers,

Jim.

Received on Monday, 22 May 2006 19:01:15 UTC