For my application I need to embed Facebook page in an iframe, here is the html code:
<html>
<head></head>
<body>
<iframe src="http://www.facebook.com" style="width:100%;height:100%">
</body>
</html>
But it does not work, any idea why and how to circumvent ?
Now it is working. Example code below:
faceframe.html
<iframe src="file:///C:/Users/Zishan Ahamed/Desktop/ff1.html" width="100%" height="350px" border="0" scrolling="auto" /></iframe>
ff1.html
<meta http-equiv="refresh" content="0; url=https://facebook.com/" />
Open faceframe.html...
Now this done. try it it's working...
You have to check for HTTP response header X-Frame-Option of those sites. if its value is "DENY or SAMEORIGIN", then you can not load those website in the iframes.
DENY = No one can load the website in iframe. Even the same domain page wont be able to load. SAMEORIGIN = only a page which is in same domain can load this website in iframe.
I know this is a bit old - but it came up in my search when I was looking for a similar answer. You can get the code to embed an iframe containing public posts, comments etc (a bit like YouTube embed) from this page: https://developers.facebook.com/docs/plugins/embedded-posts/ using the social plugins. I don't think Facebook will ever allow you to iframe the whole site though.
I belive facebook as an anti framing script. It detects if it is within a iframe and shows a logo which when you click on takes you out of the iframe. Maybe they have an sdk which allows authenticate first and then it will allow the iframe. I Don't know.
More Info: http://developers.facebook.com/search?q=Fb:iframe