- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我知道这个问题经常被问到,但我还没有找到解决办法。我使用此代码:
用
打开html标签<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
在我输入的开始标签之后的索引中
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'MY_APP_ID', // App ID from the app dashboard
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK asynchronously
(function(){
// If we've already installed the SDK, we're done
if (document.getElementById('facebook-jssdk')) {return;}
// Get the first script element, which we'll use to find the parent node
var firstScriptElement = document.getElementsByTagName('script')[0];
// Create a new script element and set its id
var facebookJS = document.createElement('script');
facebookJS.id = 'facebook-jssdk';
// Set the new script's source to the source of the Facebook JS SDK
facebookJS.src = '//connect.facebook.net/it_IT/all.js';
// Insert the Facebook JS SDK into the DOM
firstScriptElement.parentNode.insertBefore(facebookJS, firstScriptElement);
}());
</script>
最后是按钮
<fb:like href="http://mydomain.it/" layout="button_count" action="like" show_faces="false" share="false"></fb:like>
<script>
FB.Event.subscribe('edge.create',
function(href, widget) {
alert('Ti piace ' + href);
});
</script>
类似的作品,但没有打开警报,我在控制台中收到了这个错误。
Uncaught ReferenceError: FB is not defined
有什么解决办法吗?
最佳答案
查看此主题:FB is not defined in Facebook Login .
您正尝试在按钮之后使用 FB
,但尚未定义:
<fb:like href="http://mydomain.it/" layout="button_count" action="like" show_faces="false" share="false"></fb:like>
<script>
FB.Event.subscribe(...
^--- FB isn't defined yet!
将 FB.Event.subscribe
代码移到 window.fbAsyncInit
函数中,其中您有注释“附加初始化代码”
关于javascript - Uncaught ReferenceError : FB is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20400457/
我有问题,我想在那个应用程序中使用 FB 好友列表,我可以通过 FB SDK 检索 FB 好友列表...... 最佳答案 FB SDK 支持通过以下方式调用 FB graph api: - (FBRe
我有一个简单的视频,最后包含一个共享按钮,当用户单击共享按钮时,会打开一个带有社交媒体图标的模态框,例如用户可以将视频共享到 Facebook,现在我想要来自 Facebook 的回调响应视频分享后。
我收到常见的 JS 错误“ Uncaught ReferenceError :未定义 FB” 关于同一个问题有很多问题,我已经尝试了每个可用的解决方案 stackoverflow 但无济于事。显然,人
你好,我想知道如果我创建了一个 Facebook 页面(没有普通用户)是否可以获得 FB APP_ID,或者这个 ID 仅用于应用程序?谢谢 最佳答案 如果您是 Facebook 用户,请登录您的 I
我有一个客户已经有一个与他们自己的网站相关联的 Facebook 页面。我最终说服他们将开放图标签集成到他们的页面中,因为当任何人点击他们网站上的 Facebook Like 按钮时,它在 Faceb
我的问题很简单,FB Messenger如何知道谁与其他FB应用程序连接,我的意思是在iOS中,应用程序使用sandBox,但是当您在“正常”应用程序中作为“xy”连接并且打开Messenger时它会
这段最近工作完美的代码在与 FB JS API 一起使用时不再正常工作: placeOrder : function(order_info) { var onOrderPlaced = funct
我正在尝试从我使用以下代码的 facebook 广告 api 获取广告系列列表 $account = new AdAccount('act_' . $account_id);
我的控制台中有这条消息 FB.getLoginStatus() called before calling FB.init(). 我的代码 // Load the SDK Asyn
我知道有很多关于 Facebook 访问 token 的问题及其造成的痛苦,但尽管进行了大量实验并阅读了许多令人沮丧的模糊博客文章(FB 和其他),我仍在努力获得明确的答案根据我的需要。让我简要地分解
我查看了有关 stackoverflow 的各种文档和问题,但仍然无法弄清楚为什么以下代码不会触发任何 FB.Event.subscribe 事件 getLoginStatus。 (fun
我想要实现的是: 我有一个简单的 Facebook 分享按钮,取自 Facebook 开发人员。站点: 现在我在开始正文标记之前添加了同样取自 facebook 的 facebook 应用程序代码:
我想检查用户是否使用 Facebook JavaScript JDK 和 jQuery 登录 facebook。但即使超时 10 秒,我也会收到此错误消息: 在调用 FB.init() 之前调用 FB
我有一个正在编写的网站。 javascript SDK 有效 php SDK 有效 HTML 如下所示: 带有 fb-registration div 的注册页面 带有 fb-login-button
我正在尝试检查用户是否已使用我的应用登录,但我收到了 FB.getLoginStatus() called before calling FB.init(). 控制台出错。 setSize似乎有效(虽
FB.api 在 FB.init 之后立即调用时不起作用。这是我使用的代码片段: window.fbAsyncInit = function() { FB.init({ appId : w
我希望用户在单击我网页上的几个按钮之一时能够将一些图像发布到他们的 Facebook 页面。 FB.getLoginStatus(function(response) { if ( respon
我正在使用 PFFacebookUtils.logInWithPermissions 登录我的应用程序,但是,第一次登录实际登录工作正常,但出现 FB 错误 code = 2500 An active
我全新的工作充满了美妙和可怕的惊喜。这项工作最有趣的部分之一是增强、加速、使一切规模化的意愿。今天,第一个真正的问题。事情是这样的:我们得到最多 20 个列表元素,每个元素都显示自己的 Faceboo
我在这里使用 asp.net web 应用程序,我在我的网页中使用 2 个 facebook 插件。 Facebook 赞 Facebook 分享 对于 facebook 分享: Faceboo
我是一名优秀的程序员,十分优秀!