Created attachment 24449 [details]
page with an iframe that has an onbeforeunload handler. attempting to leave the page should popup the beforeunload dialog.
This looks like a duplicate of bug #19418.
See also: bug 15652.
Confirmed with r38387.
In bug #19418, the handler is installed on the body of iframe document, while here, it is installed on Window object. So, these bugs are not exact duplicates, keeping them separate for now.
Note however that fixing this may give a way to ads in iframes to be even more nasty than they are now, and open windows when navigating away from a page with an ad. They could be other undesirable consequences, as well.
(In reply to comment #5)
> Note however that fixing this may give a way to ads in iframes to be even more
> nasty than they are now, and open windows when navigating away from a page with
> an ad. They could be other undesirable consequences, as well.
From your argument I can see you are against people having guns, because, you say, some will start shooting other people.
The beforeunload event could be abused in the same way as the unload event.
People already have methods of killing other people.
If the beforeunload event does not trigger for iframes, developers have no way of stopping a navigation inside an IFRAME so the user will not have a chance to save their work.
I'm not saying having guns is a good thing, I'm just saying that the beforeunload is really useful.
I'm told (though I haven't tested) that IE and Firefox allow this. The HTML5 spec also describes beforeunload in some detail.
Yes, I know for a fact that IE and FF allow this, because I use it all day, every day.
For Webkit-based browsers, I had to play major workaround games to get this to work.
*** This bug has been marked as a duplicate of bug 19418 ***