1

Possible Duplicate:
How to prevent IFRAME from redirecting top-level window

<iframe width="980px" frameborder="0" marginheight="0" marginwidth="0" height="1500px" src="http://www.torrentz.com/search?q=<?php echo $_GET['search'] ?>" ></iframe>

I have a frame like this.Now when i run tun this in my page..its startes redirecting my to "torrentz.com"..

Have any idea how to stop it ?

Community
  • 1
  • 1
5416339
  • 417
  • 3
  • 9
  • 18
  • 1
    Take a look at this post http://stackoverflow.com/questions/369498/how-to-prevent-iframe-from-redirecting-top-level-window – Tim Sep 24 '10 at 13:35
  • You also have an HTML-injection (->XSS) vulnerability. Remember to `htmlspecialchars()` any strings you `echo` into an HTML page. – bobince Sep 24 '10 at 13:57
  • Please be aware that showing/embedding 'third-party' websites in your website using frames or IFrames is not only grudgingly seen, but can also be interpreted as copyright violation (you're claiming that this external site is part of yours). Please only do this if you have explicit permission to do so. – Bobby Sep 24 '10 at 14:12

2 Answers2

3

It's doing something known as "framebusting."

While you can stop that from happening, you really shouldn't do it. If a website has framebusting code, they don't want their site to be in frames. So you should respect that and don't embed it.

Related: How to prevent iframe from redirecting top-level window, Block iframe from setting parent.location, How can I stop child Iframes from redirecting

Community
  • 1
  • 1
NullUserException
  • 83,810
  • 28
  • 209
  • 234
0

I guess that torrentz.com does some unboxing from the iframe (prob. with javascript). In the setup you describe you can't avoid it.

Michael Banzon
  • 4,879
  • 1
  • 26
  • 28