user187294
user187294

Reputation:

break out of iframe

I have an iframe that displays a flash banner ad which has clickable links. Is there anyway to force the links to open in parent window, without putting JS on the page that opens or changing the flash file?

For example, is there something i can do to the iFrame to force links to open in its parent?

Upvotes: 1

Views: 2143

Answers (3)

austin cheney
austin cheney

Reputation:

No, you absolutely cannot do this. Your ad is likely served from a domain different than the rest of the page outside of the iframe. The only security restriction applied to JavaScript is called same origin execution. A browser will not execute any JavaScript that originates in a domain different than that of the effect page/window. As a result JavaScript is not your answer.

Upvotes: 2

CodeJoust
CodeJoust

Reputation: 3810

This little snippet should do it:

   if (top.location != location) {
     top.location.href = document.location.href ;
   }

Upvotes: 3

x0n
x0n

Reputation: 52480

If the links were HTML, yes. But since the links are embedded in the SWF itself, there is no way to change their targt, AFAIK.

Upvotes: 0

Related Questions