Question

I have a site that displays other sites through an iframe on certain pages. It does this in order to display a toolbar that is relevant to the reader (like Facebook and Owly does). However, when the user chooses to leave the original site I want the bar to go away. As you might gather, I don't control the sites in the iframe, and they're on another domain than the iframing page.

I tried target="_parent" on the <iframe>, no luck. Then I tried various scripting solutions, but they all fail due to the same domain restriction. My last try was to have a timeout check for changes in the iframe URL, but iframe.contentWindow.location.href is restricted when page is on another domain (unlike the object iframe.contentWindow.location which I found a bit weird).

Any solutions to this problem? I know iframes aren't the hottest thing around, but they do the job in this case.

Was it helpful?

Solution

No solutions.

The only way to get a link to open in the top frame is to have access to the link itself. As you observed, the same origin policy prevents JS from outside the frame accessing it.

OTHER TIPS

Try target=_top That should open the page in the full body of the window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top