[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

PHP Force Loading page in an iFrame

Hi we have a  page with an iframe that uses as source PHP pages.

we need a way to force this php pages in case they are called from outside.   direct linking, typed in url or by search engine

to be forced to load the parent page and them into the iframe

any help would be really appreciated.
0
basura
Asked:
basura
1 Solution
 
neesterCommented:
This is acutallly a HTML question...
Still need an answer?
0
 
fiboCommented:
To solve that, I would probably work from the javascript redirection mechanism.
i.e., in most of my sites there are the lines
<script language="javascript">
if (top.frames.length!=0)
top.location=self.document.location;
</script>
which checks if the page is framed or not. If it is, it because someone is framing it... and I break the frame so that my page displays alone on the browser window.

You could probably work along the lines of
<script language="javascript">
if (some condition)
top.location='http://the.full.iframed.page';
</script>
where 'some condition' might be testing the title of the topmost page etc.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now