1

I'm writing an application that needs to call a function when a popup has loaded. Currently, this is what I'm using, which works in Firefox/Chrome/Safari:

var win = window.open(...);
win.addEventListener( 'load', function () {...}, true );

However, opera does not like win.addEventListener. I tried win.opera.addEventListener too, but that also didn't help.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
anonymouse
  • 639
  • 1
  • 8
  • 18
  • possible duplicate of [Detecting the onload event of a window opened with window.open](http://stackoverflow.com/questions/3030859/detecting-the-onload-event-of-a-window-opened-with-window-open) – Diodeus - James MacFarlane Jan 10 '13 at 19:56
  • win.on('load', function(){ } Have you tried this – vajrakumar Jan 10 '13 at 19:58
  • known bug: `CORE-46278` at Opera. See also [Opera: Can't get load event from window.open()](http://stackoverflow.com/questions/10499709/opera-cant-get-load-event-from-window-open) – karlcow Jan 11 '13 at 03:33

1 Answers1

3

For the record the solution which had been found previously

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

window.setTimeout(function() {
    openedWindow.addEventListener("load", function() {
        console.log("received load event");
    }, false);
}, 0);
Community
  • 1
  • 1
karlcow
  • 6,977
  • 4
  • 38
  • 72