View Full Version : How to force a page into an iframe...but?

02-22-2008, 10:38 PM
I have a bit of a problem. I have build my website around an iFrame. There are two different versions...ala two different home pages (index.php and home.php) depending upon which version you choose at a splash screen (highband or lowband).

Here's the problem. I need to make all of the child pages incapable of being viewed outside of it's intended iFrame. The problem is, if I use the standard Javascript for forceing a page into it's intended iFrame then I can't also let it be viewable in the alternate iFrame, depending upon user choice.

Is there a way for the script to point to a default parent page but allow the child page to also be viewed in the alternate parent? So, if you found the page outside of my site it would always load the page into the default parent page. But if you came in the front door of my site, via the splash page you would have the option to view that same file within either of the parent pages...depending upon choice (highband or lowband).

Is that clear??? :confused:


02-22-2008, 11:06 PM
you want a page within an iframe to only be visible within your iframe otherwise it will load your home page?

if (window.top.location!="http://www.yourdomain.com/containor-of-iframe.php") {