Page 1 of 1

How do i ensure page is in frame

Posted: Sat Mar 13, 2004 3:10 pm
by man_with_hat
Hi gurus..etal
this is the javascript code i use to ensure that my page is in the correct frame

Code: Select all

<script type="text/javascript">
//get a string so we can use it's search method
var str = new String(top.location);
//look for str in str
//if top location == this framed page
if(str.search('<?=$PHP_SELF?>') > -1) &#123;
  //this is not within a frame so redirect this window to the top frame
  top.location="http://www.mydomain.com/myfolder/mypage.php";
&#125;
</script>
i wanna do this in php
without using header function
any idea's?
ta

Posted: Sat Mar 13, 2004 4:40 pm
by scorphus
Hello, please take the time to read this tutorial: Frames, JavaScript, and PHP Overview. Thanks,
Scorphus.