Handling Iframe Breakaway
See the full project
I'm looking for a very simple script for handling iframe breakaway. If sites like nytimes.com are included in an iframe, it'll break out of the iframe and load it in full. I'd like to find a solution to prevent iframes from breaking out.
One solution that I have thought of is to use window.onbeforeunload and ask the user to confirm the breakout. However, I'd like to let the user exit my page without any confirmation. Thus, I only want the user to be prompted if and only if an iframe is trying to breakout. Your method should work on any number of iframes.
Note that your bid should be proportional to the quality and cleanliness of the method. For example, a method prevents all breakouts should be higher than one that requires to prompt the user.
It needs to work on both IE and Firefox.



