Page 1 of 1
Frame's Parent Name
Posted: Mon Aug 09, 2004 5:37 am
by anjanesh
I have this in index.php
Code: Select all
<FRAMESET COLS="150,*" NAME="frameMain">
<FRAME NAME="frameLeft" SRC="Left.php">
<FRAME NAME="frameMiddle" SRC="Middle.php">
</FRAMESET>
Left.php contains the list of menu items. frameMiddle varies. Initially its Middle.php but when clicking a link on left it changes. For Ex. Banners.php. But I dont want anybody to enter Banner.php in the url. If he does so it'll automatically load index with Banner.php as Middle.
I tried client side checking but document.write(window.parent.frameName); is giving undefined. FRAMESET doesn't seem to support NAME property but then how else to overcome this ?
Posted: Mon Aug 09, 2004 6:12 am
by CoderGoblin
As far as I know there is no way to add a name. The question is why would you want to ?
If needed for javascript window.top relates to the top frame/window.
If usng HTML The form target should be set to <form target="_top">.
Posted: Mon Aug 09, 2004 6:30 am
by anjanesh
Well. What I dont want is user to enter Banner.php in the address bar of their browser and have that page loaded separately. If at all someone does enter Banners.php in the address bar then it should automatically load the frame page with Banner.php as Middle. If you look at MSDN and save a particular topic from the library to your hdd and then try opening the content page (which is in subfolder : right->content) it'll load the frame page automatically.
Posted: Mon Aug 09, 2004 7:02 am
by CoderGoblin
In javascript you could apply an onload event to check the frame name,
Code: Select all
if (typeof window.name == undefined) {
//reload main frame
}
No matter what there are easy ways around it. (Switching off javascript for one).
Another alternative is to not use frames and use a CSS layout instead. Unfortunately if you are in development rather than design this would mean a substantial rework.

Posted: Mon Aug 09, 2004 7:46 am
by anjanesh
Another method is to use HTTP_REFERRER to find out which script is calling it but unfortunately not all browsers send this data.
Posted: Wed Aug 11, 2004 7:33 am
by CoderGoblin
Another solution. For your subpage stick onload event to
Code: Select all
if (window == top) top.location.href = "topframe.html";