1

I want to Display Facebook's Webpage on my site ?

<html>
<body>
    <iframe src="http://www.facebook.com/" name="iframe_a"></iframe>
</body>
</html>

This just show's me an image of Facebook but not the actual content. How can i do that ?

I tried and used Php and then echoed the content on the screen that some how worked But In that case , I cant understand How shall i Login Into facebook. When i Login it get's redirected to the Main Site.

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
Yahoo
  • 4,093
  • 17
  • 59
  • 85

7 Answers7

6

This is the code facebook embedded in its pages.

if (top != self) { try { if (parent != top) { throw 1; }

This code checks if its embedded in iframe its blocks loading other data rather loads the the link to which you can click with an image.

<script type="text/javascript">
        /* <![CDATA[ */if (top != self) { 
           try { if (parent != top) { throw 1; } 
           var disallowed = ["apps.facebook.com","\/pages\/","apps.beta.facebook.com"];
            href = top.location.href.toLowerCase(); 
              for (var i = 0; i < disallowed.length; i++) {
                  if (href.indexOf(disallowed[i]) >= 0) { throw 1; } 
              } 
          } catch (e) {
             setTimeout(
                   function() {var fb_cj_img = new Image(); 
                      fb_cj_img.src = "http:\/\/error.facebook.com\/common\/scribe_endpoint.php?c=si_clickjacking&m=on\u002509&t=8183";}, 5000); 
        window.document.write("\u003cstyle>body * { display:none !important; }\u003c\/style>\u003ca href=\"#\" onclick=\"top.location.href=window.location.href\" style=\"display: block !important; padding: 10px\">\u003ci class=\"img sp_8dfqpl sx_d67a9a\" style=\"display:block !important\">\u003c\/i>Go to Facebook.com\u003c\/a>");

  /* XRCm4Hhw */ }}/* ]]> *

  </script>
Zimbabao
  • 8,150
  • 3
  • 29
  • 36
  • I tried and used Php and then echoed the content onto a DIV tagthat some how worked But In that case , I cant understand How shall i Login Into facebook. When i Login it get's redirected to the Main Site – Yahoo Feb 23 '11 at 13:51
  • You can't disable what html/js/css facebook generates on its servers. – Zimbabao Feb 23 '11 at 13:51
4

Theoretically it should be possible to do it in the following steps:

  1. Fetch the Facebook.com's html with AJAX.
  2. Remove the undesired javascript what Zimbabao pointed or add new javascript that overrides undesired function.
  3. and then do a document.write to release the modified HTML for the browser to parse and render.

This is the same principle how Javascript-function-overriding works with GreaseMonkey [1]. In [2, 3], you will find how functions can be overridden with Javascript.

Community
  • 1
  • 1
gsbabil
  • 7,505
  • 3
  • 26
  • 28
2

I think that Facebook is blocking its usage within an iframe tag.

Nans
  • 146
  • 2
  • 4
1

Use Facebook API to get your wall posts, and then display them where you like. http://developers.facebook.com/

Ivan
  • 3,567
  • 17
  • 25
  • Thanks! but i actually wanted to share my Wall with Others. I tried Php Curl and Echoed it. That worked But When i Login it get's redirected to the Main Site. – Yahoo Feb 23 '11 at 13:53
  • With API you can get all your wall posts, so you can do anything you want with them afterwards. Take a look at Graph API on http://developers.facebook.com/docs/reference/api/ you will see that it is easy to grab all your wall posts with php and then display them on your website. – Ivan Feb 23 '11 at 14:24
0

Iframe your facebook content like this:

<iframe src="http://www.facebook.com/plugins/likebox.phpid=YOURUNIQUEID&amp;width=158&amp;connections=5&amp;stream=true&amp;header=false&amp;height=555" 
        scrolling="no" 
        frameborder="0" 
        style="border:none; overflow:hidden; width:158px; height:555px;" 
        allowTransparency="true">
</iframe>

<div class="fb-like" 
     align="center" 
     data-href="https://www.facebook.com/YOURFBADDRESS" 
     data-send="true" 
     data-width="500" 
     data-show-faces="false" 
     data-font="verdana">
</div>
tbraun89
  • 2,246
  • 3
  • 25
  • 44
Andy
  • 9
  • 1
0

it makes really no sense to display facebook in an iframe on your website.

if you want to display facebook content on your page use Facebook Badges

felixsigl
  • 2,900
  • 1
  • 23
  • 16
0

This question is old. Now all the posts on FB have a embed with iframe, or direct link

Vitalicus
  • 1,188
  • 13
  • 15