In answering my question Pumbaa80 found a difference between calling open()
and window.open()
, try the following examples in Firefox
This is indeed very strange. It looks like The onclick
handler when added as an attribute has some context with a wrapped open
function that differs from window.open
:
http://jsfiddle.net/aFujb/
This happens in latest Firefox, Safari and Chrome. I can't find any explanation or bug report for either browser.
I tried to find out what's happening in Firefox's source code, but quite honestly it's too much for me atm. Looks there's two different window.open implementations called nsGlobalWindow::Open
and nsGlobalWindow::OpenJS
, but I'm not sure whether this has something to do with the question.