嵌入式Facebook Like-Box不会让我对其进行样式设置.为什么? [英] Embedded Facebook Like-Box won't let me style it. Why?

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

问题描述

我正在尝试在我网站的页面上放置一个Facebook Like-Box,然后通过我自己的CSS设置其样式(主要是为了增加授予div#stream_content的高度.(这个想法是让FB 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
http://www.daddydesign.com/wordpress/如何自定义您的Facebook粉丝框/
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 html lang ="en" xmlns:fb ="http://www.facebook.com/2008/fbml" xml: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">

所以我在页面正文中有这个:

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)不安全的JavaScript尝试从URL为 http://www.facebook.com/plugins/likebox.php?frame=URL的框架访问URL为...(我的网页)...?%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天全站免登陆