0

I have this iframe (different domain) inside my page. I have also this script that is supposed to close the page when some conditions are verified.

I encountered the problem that when the page inside the iframe changes the onbeforeunload method asking me the confirmation, the script obviously freezes wainting for a response. I tried to avoid that dialog with no success.

Is there a way to answer to the confirmation dialog automatically or to suppress it ?

Advicer
  • 1,300
  • 1
  • 14
  • 26
  • The only way to suppress the confirm would be to modify the iframe's `onbeforeunload` handler. Since it's served from a different domain, you can't modify the handler, so this is not possible. – jbabey Nov 09 '12 at 16:45
  • I can't skip it, ok; but isn't there a way to automatically respond that confirmation dialog? – Advicer Nov 09 '12 at 16:51
  • No, there is no way to programatically respond. – jbabey Nov 09 '12 at 17:05

1 Answers1

0

You could clean the onbeforeunload funcction with

window.onbeforeunload = null;

// or for the iframe

window.frames[0].onbeforeunload = null;

Hope it helps.

  • 1
    That won't work. The question states the iframe points to a different domain, so the Same Origin Policy would prevent it. – Quentin Nov 09 '12 at 16:28