Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google chrome onbeforeunload wrong behavior with iframe

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 you close tab when iframe is in focus. I suppose it is a bug as written here: Google Chrome issues

But I mentioned that, for example, google docs handle this situation. Can anyone give me a solution? Important note that I have no actual access to the iframe content as it is a third party html editor (WYSIWYG).

like image 636
Vetragon Avatar asked Oct 21 '09 14:10

Vetragon


1 Answers

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.

like image 188
Lucky Murari Avatar answered Nov 08 '22 08:11

Lucky Murari