我是否需要 XFBML 版本的 Facebook Like 按钮的 appId? [英] Do I need an appId for a XFBML version of the Facebook Like button?

查看:23
本文介绍了我是否需要 XFBML 版本的 Facebook Like 按钮的 appId?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很困惑.

我正在尝试在我的网站上使用一些非常简单的 Facebook 插件,特别是基本的喜欢"按钮.

I'm trying to use some of the very simple Facebook plugins on my site, specifically the basic "Like" button.

我已经知道如何使用带有 iFrame 的受限版本.

I already know how to use the limited version with an iFrame.

但是,现在我正在尝试找出 XFBML 方法,并且在线文档似乎对您已经知道的内容做出了很多假设,并且非常缺乏工作示例.例如,他们向您展示了如何调用 JavaScript Init 并为您提供元素 fb:like 的单行 HTML 代码...但我看不到任何有关如何显示/隐藏面孔、设置默认字体等的示例. 就像在 iFrame 代码中一样.

However, now I'm trying to figure out the XFBML method and the online documentation seems to make a lot of assumptions about what you already know and really short on working examples. For example, they show you how to call the JavaScript Init and give you the single line of HTML code for element fb:like... but I could not see any examples of how to show/hide faces, set the default font, etc. like in the iFrame code.

我后来发现您需要将它们作为属性添加到元素中,但这要归功于 StackOverlfow,而不是 Facebook 文档,它只是简单地将您带入了圈子.

I've since figured out that you need to add them as attributes to the element but that was thanks to StackOverlfow and no thanks to the Facebook documentation which simply takes you in circles.

<fb:like href="http://mydomain.com" show_faces="true" action="recommend" colorscheme="light" width="400" height="35" />

好的,现在使用 XFBML 代码时,它的高度应该根据我是否登录而自动扩展/收缩.

Ok, so now when using the XFBML code, it's height should expand/contract automatically depending on being logged in or not I assume.

我不知道我最初是应该将高度设置为80"还是自动设置.

I do not know if I'm supposed to initially set the height to "80" or if that happens automatically.

而且我不知道我应该在 Init 脚本中为您的应用程序 ID"使用什么.没有应用程序......只是一个 Facebook 公司页面......那么当我在网站上放置一个赞按钮时,为什么我需要一个应用程序 ID?

And I have no idea what I'm supposed to use for 'your app id' in the Init script. There is no App... just a Facebook Company Page... so why would I need an App Id when I'm just putting a Like button on a website?

<script>
window.fbAsyncInit = function() {
  FB.init({
    appId: 'your app id',
    status: true,
    cookie: true,
    xfbml: true
  });
};

对这些问题的任何启发将不胜感激.

Any enlightenment on these issues would be appreciated.

谢谢!

推荐答案

在拔掉我所有的头发后回答我自己的问题...

Answering my own question, after pulling out all my hair...

http://developers.facebook.com/docs/guides/web/

JavaScript SDK 要求您在 Facebook 注册您的网站以获取应用 ID(或 appId).appId 是您网站的唯一标识符,可确保我们拥有在用户和您的网站之间设置适当的安全级别.以下示例展示了如何在您拥有 appId 后加载 JavaScript SDK:"

"The JavaScript SDK requires that you register your website with Facebook to get an App ID (or appId). The appId is a unique identifier for your site that ensures that we have the right level of security in place between the user and your website. The following example shows how to load the JavaScript SDK once you have your appId:"

http://developers.facebook.com/setup/

该页面/表单的标题是创建应用.我仍然不明白为什么他们不使用更通用的术语.我不是在创建应用",我也不认为我的网站是一个应用.

The title of that page/form is Create an App. I still don't understand why they don't use more generic terminology. I'm not "creating an app" and I don't consider my website to be an app.

这篇关于我是否需要 XFBML 版本的 Facebook Like 按钮的 appId?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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