嵌入式Facebook Like-Box不会让我风格化。为什么? [英] Embedded Facebook Like-Box won't let me style it. Why?

查看:251
本文介绍了嵌入式Facebook Like-Box不会让我风格化。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在我的网站的页面上放置一个Facebook Like-Box,然后通过我自己的CSS风格(主要是增加div#stream_content的大小(这个想法是有FB feed动作作为新闻Feed,但我不想让用户滚动看到更多的前两个项目,因此它是默认情况下)。

I am trying put place a Facebook Like-Box on a page on my site, and then style it via my own CSS (chiefly to increase the height awarded to div#stream_content. (The idea is to have the FB feed act as a news feed, but I don't want the user to have to scroll to see more the top two items or so as it does by default).

我有阅读并尝试这些文章的建议和更多:
http://stackoverflow.com/questions/4064038/customizing-facebook-like-box

< a href =http://www.daddydesign.com/wordpress/how-to-customize-your-facebook-fan-box/ =nofollow> http://www.daddydesign.com/wordpress/how -to-customize-your-facebook-fan-box / ,

http://hitech-tips.blogspot.com/2010/05/facebook-like-button-xfbml-tutorial.html

I have read and experimented with suggestions from these articles and more: http://stackoverflow.com/questions/4064038/customizing-facebook-like-box,
http://www.daddydesign.com/wordpress/how-to-customize-your-facebook-fan-box/,
http://hitech-tips.blogspot.com/2010/05/facebook-like-button-xfbml-tutorial.html

我将使用FBML路由(而不是使用iframe),因为我需要使用跨域样式表。我还收集我需要这个doctype声明我的网页:

<!doctype html lang =enxmlns:fb =http://www.facebook.com / 2008 / fbmlxml:lang =en>

I am going the FBML route (rather than using an iframe) as I gather is required for applying a cross-domain stylesheet. I gather also that I need this doctype declaration for my webpage:
<!doctype html lang="en" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en">

所以我在页面的主体中有这个: p>

So then I have this in the body of the page:

    <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    <fb:like-box
            profile_id="***my ID here***" 
            width="450"
            height="600"
            colorscheme="dark"
            show_faces="false"
            stream="true"
            header="false"
            logobar="0"
            css="http://***my domain here***/css/FBstyles.css?1"
            href="http://www.facebook.com/***my page name here***"
    ></fb:like-box>

但我还是得到了这些错误:
(4)访问帧与URL ...(我的网页)...从框架与URL http://www.facebook.com/plugins/likebox.php?channel=http%3A%2F%2Fstatic。 ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%3Fversion%3D2%23cb%3Dfd907a0e%26origin ... blahblahblah 。域,协议和端口必须匹配。

But I still get these sorts of errors: "(4) Unsafe JavaScript attempt to access frame with URL ...(my webpage)...from frame with URL http://www.facebook.com/plugins/likebox.php?channel=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%3Fversion%3D2%23cb%3Dfd907a0e%26origin...blahblahblah. Domains, protocols and ports must match."

我在哪里修改?

推荐答案

虽然您使用的是FBML,但实际的嵌入式代码最终仍然是一个iframe。 (您可以在加载后使用HTML检查器在DOM中查看它)。关于我唯一能做的是把它放在一个带有彩色背景的div中,因为iframe是透明的,并且有一个边框。

I went this route too. Although you are using FBML, the actual embedded code ends up being an iframe anyway. (you can see it in the DOM with an HTML inspector after it loads). About the only thing I was able to do was put it in a div with a colored background, since the iframe is transparent, and a border.

你可能得到错误因为Facebook服务器上的javascript试图访问您的服务器上的CSS。我不认为你可以这样做。

You are probably getting errors since the javascript on the Facebook server is trying to access the CSS on your server. I didn't think you could do this.

编辑

你提供的StackOverflow链接,发布的答案清楚地说明使用自己的CSS只适用于一个风扇框,而不是一个喜欢框。

In the StackOverflow link you provided, the posted answers clearly state that using your own CSS only works with a "Fan" box, not with a "Like" box.

这篇关于嵌入式Facebook Like-Box不会让我风格化。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆