Home > Ajax, CSS, Javascript, XHTML > Handling Iframe Breakaway

Handling Iframe Breakaway

November 28th, 2009

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.

It needs to work on both IE and Firefox.


Handling Iframe Breakaway

Comments are closed.
Bear