PHP Force Loading page in an iFrame

Posted on 2006-06-01
Last Modified: 2006-11-18
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.
Question by:basura
    LVL 11

    Expert Comment

    This is acutallly a HTML question...
    Still need an answer?
    LVL 29

    Accepted Solution

    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)
    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)
    where 'some condition' might be testing the title of the topmost page etc.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    A colleague recently asked me about how to give his client a small part of the web site that could be completely under the client's control.  Since I have done this sort of thing before to add emergency banners to a web site, I decided I would creat…
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to count occurrences of each item in an array.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now