0

it has been a while since my last time working with iframes, now i need to load some external sites inside iframes but nothing is happening. This are the iframe tags, the wierd thing is that nothing is being shown inside this iframes. Is there something that im missing?

        for ($j = 1; $j < 10; $j++) {
               $urls[] = 'http://www.facebook.com/profile.php?id='.$friends["data"][$j]["id"];

        }

        echo '<div class="container"><div class="row-fluid">';
        foreach($urls as $url){
            echo '<iframe id="face" name="face" src="'. $url .'" style="width: 100%; height: 200px;"></iframe><br>';
        }
        echo '</div></div>';
    }

Each $url is a friend's facebook profile and they are being loaded perfectly fine but nothing is being shown inside my iframes. Any ideas? i also tried with google.com... same thing, nothing is being shown.

Fo Nko
  • 620
  • 10
  • 22
  • 1
    i found this: http://stackoverflow.com/questions/9158024/iframe-with-external-page-not-working so im guessing i wont be able to load any site that uses this headers. :( – Fo Nko Mar 03 '13 at 21:06
  • 1
    yup, that seems to be the case – Pekka Mar 03 '13 at 21:07
  • thx sr! i guess im gonna need to find some other work around for this. – Fo Nko Mar 03 '13 at 21:08

1 Answers1

2

Likely because Facebook has explicitly disallowed iframing their pages using the X-FRAME-OPTIONS header. This is primarily a security measure, supported by newer browsers.

Look in your browser's console for a message like this:

Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
Matt Ball
  • 354,903
  • 100
  • 647
  • 710