Google chrome onbeforeunload wrong behavior with iframe

前端 未结 3 757
独厮守ぢ
独厮守ぢ 2021-02-13 20:18

Let say I have two pages. One of them contains another one inside as iframe. If you subscribe to onbeforeunload event on the parent page, then this event doesn\'t triggers if yo

3条回答
  •  半阙折子戏
    2021-02-13 20:32

    I know it is an old question but just to help people who are coming here through Search :

    The bug is fixed by now here.

    Since chrome 10, the issue should be fixed.

    There is a related bug though here.

    So, in short if you still not able to fire "onbeforeunload" on frames, it could be due to change in the content through JavaScript like document.open document.write document.close etc.

提交回复
热议问题