facebook共享错误:“;方法“;是FB.ui()的必需参数
facebook share error: "method" is a required parameter for FB.ui()
标题说明了一切。我总是收到这样的错误:"method"是FB.ui()的必需参数。但方法被设置为"feed"
这是因为我目前在我的机器上本地工作,而不是在真正的服务器上吗??该应用程序也在脸书上注册。
知道吗?
<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>
$('#share').click(function(e){
部分的代码应该进入窗口。fbsynchInit调用确保在将点击事件分配给使用FB的东西之前加载框架。
我用自己的应用程序ID测试了同样的代码,它对我来说很好。唯一的区别是我把名称、标题和描述改为"This",最后我修复了一个语法问题。
你确定这段代码是你的错误来源吗?
- 您必须在服务器上联机(实际上是服务器)
- 如果你这行没有Facebook idFB.init({appId:'2907534********',状态:true,cookie:true,xfbml:true});你必须有一个来自这个网址:https://developers.facebook.com/或搜索如何创建facebook应用程序(如何创建facebook应用程序)的示例hyperarts.com/blog/how-create-facebook-application-to-get-an-app-id-for-your-website/
- 但如果你已经有了facebook id,并且已经知道如何创建应用程序,你必须把代码放在顶部,放在你放在facebook画布上的同一个文件上
例如,如果您在画布中插入(https://www.example.com/test.php)您必须将此代码放在test.php 中
我希望你的问题能很快得到解决!
相关文章:
- 如何使用skip参数使用angular ui引导进行服务器端分页
- EJS中的Angularjs-Ui路由器参数
- angularjs-ui路由器父状态,参数加载在子状态之后
- Angularjs-ui路由器使用不同的参数进入相同的状态
- 将URL参数传递给ui sref
- UI 路由器参数 URL 不起作用,只是重定向到 /
- 重用需要“解析”参数的“ui-route”控制器
- 如何将参数传递到 UI 路由器状态的模式窗口
- jQuery UI 选项卡 - 将参数设置为下一个/上一个按钮单击
- 对 Angular UI 路由器使用多个正则表达式参数
- JavaScript |角度 |UI 路由器:$urlRouterProvider使用参数重定向
- 如何停止Angular UI路由器将可选参数从一个路由传递到完全不同的路由
- Angular UI路由器:UI不使用参数构建href
- 无法让悬停事件使用 jQuery UI 持续时间参数或 CSS 处理目标元素的同级元素
- Angular ui路由器可选url参数
- 当名称空间在id参数之前声明时,Angular UI路由器停止工作
- ui路由器(0.2.18),带点参数
- 使用ui路由器在URL路由中创建一个必需的参数
- 重新加载嵌套状态,而不是具有 url 参数 ui 路由器的父级
- AngularJS的多个url参数(ui-router)