我有这个代码,假设工作,但不起作用.如果这对你有帮助,那就太好了.
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'><img src="images/fb.png" /></a></p>
<p id='msg'></p>
<script>
FB.init({appId: "338334836292077", status: true, cookie:
true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_uri:'https://www.facebook.com/cryswashington?fref=ts',
link:'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
Run Code Online (Sandbox Code Playgroud)
我想在我的网站上添加facebook分享按钮,这应该只是将我的网站内容发布在墙上.谁想分享它.
我研究了很多但没有得到任何东西.请帮助我.
提前致谢.
javascript share facebook facebook-javascript-sdk facebook-social-plugins
我正在围绕"响应式设计"概念开发一个网站,但facebook社交插件是静态宽度,并在重新调整大小时"打破"布局.
使用媒体查询,我已将插件设置为隐藏在低分辨率浏览器(移动设备等)上.但是,在桌面浏览器上,当浏览器窗口的大小较小,但不是很小以隐藏插件时,它们会突破布局.
有什么办法为Facebook社交插件设置一个流畅的宽度?
我在我的html页面中使用过这个...
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'xxxxxxxxxxxxxx', // App ID from the App Dashboard
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK's source Asynchronously
// Note that …Run Code Online (Sandbox Code Playgroud) configuration facebook-javascript-sdk facebook-social-plugins
我正在创建一个简单快速的网站,我正在尝试尽可能地优化网站.我注意到社交媒体按钮正在减慢网站的速度.我包括Facebook Like Button,Twitter Button和Google+ Button.所以我跑了几个测试:
网站没有社交媒体按钮,加载时间0.24s:

网站有社交媒体按钮,加载时间1.38s:

这是我的代码:
<div id="social">
<!-- FB -->
<div id="fb-root"></div>
<script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_EN/all.js#xfbml=1&status=0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="http://facebook.com/textsearcher" data-width="150" data-layout="button_count" data-show-faces="false" data-send="false"></div>
<!-- TWITTER -->
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.textsearcher.com/" data-hashtags="TextSearcher">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<!-- G+ -->
<div class="g-plusone" data-size="medium" data-href="http://www.textsearcher.com/"></div>
<script type="text/javascript"> (function() { var po = document.createElement('script'); po.type …Run Code Online (Sandbox Code Playgroud) html javascript facebook-social-plugins twitter-button google-plus-one
Facebook推出了一个新的页面插件来取代Like框插件.
文档:https://developers.facebook.com/docs/plugins/page-plugin/
我正在用这个新的插件替换Like Box插件.在一些网站上,我使用这个CSS代码使插件在元素内响应:
.fb-like-box, .fb-like-box span, .fb-like-box span iframe[style] {width: 100% !important;}
Run Code Online (Sandbox Code Playgroud)
用这个代码替换它不起作用:
.fb-page, .fb-page span, .fb-page span iframe[style] {width: 100% !important;}
Run Code Online (Sandbox Code Playgroud)
我的页面插件代码如下所示(不提供数据宽度属性):
<div class="fb-page" data-href="https://www.facebook.com/MyFacebookPage" data-height="1200" data-hide-cover="false" data-show-facepile="true" data-show-posts="true"></div>
Run Code Online (Sandbox Code Playgroud)
看起来Facebook已经在iframe加载的DOM中添加了一个带有内联样式元素的div元素:
<div style="min-width: 280px; width: 340px;" id="u_0_0">
...content of the plugin...
</div>
Run Code Online (Sandbox Code Playgroud)
当我将此宽度调整为100%时,除了封面照片外,每个元素都以全宽对齐.
可以像使用Like框插件一样为这个新的Page插件提供响应式行为吗?
是否有可能使Facebook的评论小部件流畅?他们的文档显示了fb:commentsxfbml或iframe 的宽度字段,其指定为:
也许这不可能......
我正在尝试设置Facebook评论社交插件.该插件将被设置为使我们网站上的每个产品页面都有一个带有唯一URL的评论插件.我希望能够将所有评论放在一起,这应该可以通过Facebook上的评论主持人工具来完成.
我可以将社交插件放在页面上,并将其链接到相应的应用程序ID,但我没有在审核工具上看到任何评论:https://developers.facebook.com/tools/comments
页面上的代码是这样的:
<div id="fb-root"></div>
<script type="text/javascript" language="javaScript">
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=[appid]";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Run Code Online (Sandbox Code Playgroud)
然后......
<meta property="fb:app_id" content="[appdid]"/>
<div class="fb-comments" data-href="http://www.testtesttest.com/" data-num-posts="2" data-width="" data-colorscheme="dark"></div>
Run Code Online (Sandbox Code Playgroud)
重要的是要注意,现在我实际上正在使用URL testtesttest.com,但我在应用程序ID位置输入了我的实际应用程序ID.
我这样做,可以发表评论到页面.但是,我在审核工具中看不到任何内容.关于我可能做错什么的任何建议?有没有人得到这个成功的工作?我不确定我的应用是否设置错误,或者是否存在网址匹配问题或域名问题.我不知道从哪里开始.
谢谢!
我想这样做facepile使用图形API开放图2点的操作:从自定义对象和自定义对象,给我做了这个对象上这个动作的朋友(使用我的Facebook应用程序).
问题是使用FQL,我无法查询自定义对象和操作.使用图形API,我无法找到一种方法将我的朋友列表与我感兴趣的对象相交.
我能做的最好的是使用图API的批处理模式:
batch=[
// First we get the list of friends that are using my facebook application
{ "method": "GET", "relative_url": "fql?q=SELECT+uid+FROM+user+WHERE+uid+IN+(SELECT+uid1+FROM+friend+WHERE+uid2=me())+AND+is_app_user=1+LIMIT+0,49", "name": "friends"},
// Then query each friend to get the list of objects that went through my namespace:testaction
{ "method": "GET", "relative_url": "{result=friends:$.data.0.uid}/namespace:testaction" },
{ "method": "GET", "relative_url": "{result=friends:$.data.1.uid}/namespace:testaction" },
...
{ "method": "GET", "relative_url": "{result=friends:$.data.49.uid}/namespace:testaction" }
]
Run Code Online (Sandbox Code Playgroud)
这是非常低效的,并没有完全解决我的问题,因为:
你看到更好的方法吗?
api facebook-graph-api facebook-social-plugins facebook-opengraph open-graph-beta
在我们的iOS应用程序中,我们有一个UIWebView,在我们的域上显示具有Facebook评论模块的Web内容.评论模块要求用户使用Facebook登录.当用户点击登录按钮时,他们将通过登录流程,但永远不会重定向回我们的页面.他们最终在FB拥有的页面上告诉用户"你现在已登录".
Repro步骤:
登录后(步骤3)我希望在成功验证后,您将被重定向回原始页面(例如http://foo.com/test.htm),以便继续进行交互.但是,这种情况并没有发生.
相反,你在FB拥有的页面上只是说"你现在已经登录"并且你被困在那里.没有重定向发生.
这确实是一个错误,还是我应该做些什么来确保重定向发生?
要在我的应用程序上插入社交登录集成,我将Socialite库添加到我的Laravel应用程序中.我有一个注册的facebook应用程序和laravel文档中的两个方法:http://laravel.com/docs/5.0/authentication#social-authentication
public function redirectToProvider()
{
return Socialize::with('github')->redirect();
}
public function handleProviderCallback()
{
$user = Socialize::with('github')->user();
dd($user);
}
Run Code Online (Sandbox Code Playgroud)
该请求成功提交并从Facebook返回,但一旦我到达回调URL:localhost:8000/social(其中handleProviderCallback())被调用,我收到以下错误:
RequestException.php第51行中的RequestException:cURL错误60:SSL证书问题:无法获取本地颁发者证书
我试过关闭我的防火墙,但没有成功..真的很沮丧,有人可以帮助我吗?