2
var openedWindow = window.open("test.html", "title");

openedWindow.addEventListener("load", function() {
    console.log("received load event");
}, false);

I want to get the load event from an opened window. The code above works, but the callback function does not get called in Opera 11.62 (works on other browser).

EDIT: It works when i register the event after 0ms timeout:

var openedWindow = window.open("test.html", "title");

window.setTimeout(function() {
    openedWindow.addEventListener("load", function() {
        console.log("received load event");
    }, false);
}, 0);
tshepang
  • 12,111
  • 21
  • 91
  • 136
Martin
  • 61
  • 7

1 Answers1

0

this seems to be a known bug in Opera - I've pushed the internal bug report (CORE-46278) a little bit forward.

The only workaround I can think of is adding callbacks from the popup contents - type opener.popupLoaded(). This may however offer a performance advantage too - you can start interacting with the popup when its script environment is ready and the script you want to talk to is running, rather than waiting for the load event.

hallvors
  • 6,069
  • 1
  • 25
  • 43