pHP q? programmers

Out of context: Reply #8

  • Started
  • Last post
  • 15 Responses
  • lifeinbinary0

    on a last resort if I have to use iframes, how can I redirect the user to view the whole homepage when he reaches the iframe document coming from a search portal??

    (Jul 10 05, 18:41)

    -------

    i am not sure what you asked about the php, didn't quite understand. but the iframe thing can be done with using javascript. here's the code:

    if (parent.location.href == self.location.href)
    window.location.href = 'index.htm';

    index.htm can be any page you want the iframe to go to. put this code in an external .js file or even put it directly in the head section of the html.

    so basically if someone tries to access the iframe without going to the parent frame first, they will be redirected to go the parent frame.

    as a result, the user will not be able to access just the iframe. they always will have to go visit it through the parent frame. i hope that made sense.

View thread