0

i am using iframe with jquery, like below. Problem is load event is not firing up on microsoft edge browser. I can run the below code with all other browsers. Is there any way or work around to do this?

 $('#reportIframe').on('load', function () {
    alert('iframe loaded sucessfully');
});
Web_Designer
  • 72,308
  • 93
  • 206
  • 262
Velkumar
  • 446
  • 1
  • 8
  • 20
  • 1
    Is the content of the iframe on the same domain as the parent window? – Rory McCrossan Oct 26 '15 at 09:25
  • 1
    Possible duplicate of [Load event for iFrame not fired in IE](http://stackoverflow.com/questions/4334520/load-event-for-iframe-not-fired-in-ie) – Alex Oct 26 '15 at 09:36
  • 1
    dublicate: http://stackoverflow.com/questions/4334520/load-event-for-iframe-not-fired-in-ie – Alex Oct 26 '15 at 09:36
  • 1
    @Alex what are the odds that 2 Alex post the exact same thread in the exact same second? :D – Alex Oct 26 '15 at 09:37
  • 1
    See my answer here: http://stackoverflow.com/a/36155560/3894981 – dude Mar 22 '16 at 13:32

1 Answers1

0

If iframe load event already fired before binding event (maybe because of cache behaviour) and iframe is on same domain, you could try:

$('#reportIframe').one('load', function () {
    console.log('iframe loaded');
}).each(function () {
    if (this.contentDocument.readyState === "complete") $(this).trigger('load');
});
A. Wolff
  • 74,033
  • 9
  • 94
  • 155
  • Can you answer this question: `Is the content of the iframe on the same domain as the parent window?` ??? – A. Wolff Oct 26 '15 at 10:27
  • I can confirm that `readyState` will be always `complete` in Chrome 49, even if the iframe is not loaded completely. So this seems to be not a solution. – dude Mar 21 '16 at 07:24