【发布时间】:2012-01-29 17:39:48
【问题描述】:
标题说明了一切。我总是得到这个错误: “方法”是 FB.ui() 的必需参数。但是方法设置为'feed'
是因为我目前在我的机器上本地工作,而不是在真正的服务器上? 应用程序也已在 facebook 中注册。
有什么想法吗?
<span id='share'>SHARE</span>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '2907534********', status: true, cookie: true, xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#share').click(function(e){
e.preventDefault();
FB.ui({
method: 'feed',
name: 'This is the content of the "name" field.',
link: ' http://www.hyperarts.com/',
picture: 'http://www.hyperarts.com/external-xfbml/share-image.gif',
caption: 'This is the content of the "caption" field.',
description: 'This is the content of the "description" field, below the caption.',
message: ''
});
});
});
</script>
【问题讨论】:
-
这似乎是您的应用程序的问题,因为任何共享选项都不适用于您的 APP_ID(取自
link指定的站点)请确保您的应用程序配置正确且未被阻止。跨度>
标签: javascript facebook share