Jump to content


Photo

Detecting if Page Is Inside an Iframe


  • Please log in to reply
3 replies to this topic

#1 thewird

thewird
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 07 March 2006 - 10:11 PM

Is there anyway to detect if a page is inside an iframe in PHP? Or is there a script that can do this? THanks.

thewird

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 08 March 2006 - 12:10 AM

No. php runs on the server. iframes run on the client. Javascript can do something for you - maybe. Google from javascript frame detection and/or frame busting.
Legend has it that reading the manual never killed anyone.
My site

#3 thewird

thewird
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 08 March 2006 - 12:13 AM

What if I'm the one creating the iframe? Is there anything I can do to give some sort of signal?

thewird

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 08 March 2006 - 01:11 AM

[!--quoteo(post=352689:date=Mar 7 2006, 07:13 PM:name=thewird)--][div class=\'quotetop\']QUOTE(thewird @ Mar 7 2006, 07:13 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]What if I'm the one creating the iframe? Is there anything I can do to give some sort of signal?[/quote]
Well, that's a different question entirely. If you created the iframe you already know that you've placed a page in it, don't you? 'Some sort of signal' - to do what? how? when? why? Add some code to it ....
<?php
echo "Hello world. This is in an iframe";
$whereami = "framed";
?>
If you want to explain what you're trying to do, then maybe someone can come up with a solution for you. Otherwise, it's just a guess at what might work.

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users