Break Out of IFRAME when URL changes

frenchboy

Power Member
Joined
Aug 19, 2008
Messages
769
Reaction score
1,380
I'm framing in a portion of anotherwebsite.com on mywebsite.com/page (urls are just for example), which looks just fine and gives me the desired result I'm looking for. However, when someone clicks on a link inside the IFRAME the content inside the IFRAME will change to something like anotherwebsite.com/contactus, but I will not want these other pages to be embedded inside the IFRAME. I would like to have the user broken out of the IFRAME somehow into a pop up window with the full URL or just have the browser load the new URL. Is there anyway to detect this URL change and break the user out of the IFRAME? The website embedded in the IFRAME is not mine, so I don't have control over the content or code behind the site. Thanks.
 
Can you make your post a bit clear please, I am sort of confused. I know you could control few of iframe features...

but are you iframing it with zeros or visitors can see it?
 
Simple answer and first thought: No you cannot.

Second thought answer:
It may be possible. If I am thinking right, you could do this with some simple JavaScript to constantly check the DOM for changes of the <iframe> src attribute. If it is not the original value then you issue the breakout code. If it is the original value you do nothing.

Set this function to run every second or half second. That should give you an acceptable real time.
 
Can you make your post a bit clear please, I am sort of confused. I know you could control few of iframe features...

but are you iframing it with zeros or visitors can see it?

Visitor can see a piece of the page, but not the whole thing. In that piece that they see, there is a link, once they click the link, I would like the iframed page to break out of its frame and be seen completely.

By the way, if someone would like to code something that does this I'd gladly pay for it.
 
How do you stop the iframe breaker, any suggestions anyone?
 
use some javascript. if i remember right "top.location=url" should do the job.
this works like a redirect then, so any iframe should break here.
 
Back
Top