forced framing of php page
| From: | Chris Hayes | Date: | Tue, 05 Dec 2000 16:07:48 +0000 |
| Subject: | forced framing of php page | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28721@lists.php.net to get a copy of this message | ||
Dear group,
a friend ("Loek Hilgersom" <loek@antenna.nl>) asked me to forward this question:
<LOEK TALKING>
I am looking for a PHP script that checks whether my pages are
loaded within the right frameset. If not, it should load the same
page again, but then within my frameset.
I have made a script-version of my frameset, but don't know how to
make a PHP script that checks whether a page is loaded within
the right frameset, and I prefer not to rely on javascripts.
Can someone help me out?
Here is a simplyfied version of the frameset:
<html>
<frameset rows="82,1*">
<frame src="head.htm" scrolling="NO" name="heading">
<frameset cols="140,1*">
<frame src="bar.htm" name="bar">
<frame src="intro.htm" name="text">
</frameset>
</frameset>
</html>
For this I made the following PHP version:
<frameset rows="82,1*">
<frame src="head.htm" name="heading">
<frameset cols="140,1*">
<frame src="bar.htm" name="bar">
<?php
if (! $url) $url = "intro.htm";
echo '<frame src="'.$url.'"
name="text">'."\n";
?>
</frameset>
</frameset>
</LOEK TALKING>
-------------------------------
I gave him the usual javascript, which is quite browser-safe but of course
php will always work, where javascript will work sort of 'less always'.
In javascript you can read:
- the pages URL
- the top pages URL (if available) which would be the frame index
if they compare equal the page is not in a frame.
Can this be done with PHP, and is this on all servers?
Chris
--------------------------------------------------------------------
-- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands --
--------------------------------------------------------------------