在我的网站上的Iframe中显示Facebook

时间:2011-02-23 13:26:38

标签: php iframe frame

我想在我的网站上显示Facebook的网页?

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

这只是展示了我的Facebook形象而不是实际内容。我怎么能这样做?

我尝试并使用了Php然后在屏幕上回应了一些如何工作的内容但在那种情况下,我无法理解我将如何登录到Facebook。当我登录时,它被重定向到主站点。

7 个答案:

答案 0 :(得分:6)

这是嵌入在其页面中的代码facebook。

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

此代码检查其嵌入在iframe中的块是否加载了其他数据而是加载了您可以使用图像单击的链接。

<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>

答案 1 :(得分:4)

理论上应该可以按以下步骤进行:

  1. 使用AJAX获取Facebook.com的HTML。
  2. 删除Zimbabao指向的不需要的javascript或添加覆盖不良功能的新javascript。
  3. 然后执行document.write以释放修改后的HTML以供浏览器解析和渲染。
  4. 这与Javascript-function-overriding如何与GreaseMonkey [1]一起使用的原理相同。在[2,3]中,您将找到如何使用Javascript覆盖函数。

答案 2 :(得分:2)

我认为Facebook在iframe标签中阻止其使用。

答案 3 :(得分:1)

使用Facebook API获取您的墙贴,然后将其显示在您喜欢的位置。 http://developers.facebook.com/

答案 4 :(得分:0)

在你网站上的iframe中显示facebook是没有意义的。

如果您想在页面上显示Facebook内容,请使用Facebook Badges

答案 5 :(得分:0)

iframe你的Facebook内容是这样的:

<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>

答案 6 :(得分:0)

这个问题很旧。现在,FB上的所有帖子都嵌入了iframe或直接链接

相关问题