【发布时间】:2016-06-30 21:29:47
【问题描述】:
我正在尝试使用 facebook javascript SDK 创建一个分享按钮:
- 在 Facebook 开发人员页面上 - Facebook 登录 - 有效的 OAuth 重定向 URI
我添加了我的开发 URL:http://localhost:5000/
我已将此代码添加到我的页面中
window.fbAsyncInit = function() {
FB.init({
appId : 'my app id xxxxxxxxxxxxx',
xfbml : true,
version : 'v2.6'
});
};
(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/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
$('.btnShare').click(function () {
FB.ui({
method: 'feed',
link: "http://localhost:5000/",
picture: 'http://localhost:5000/src/assets/image.JPG',
name: "The name who will be displayed on the post",
description: "The description who will be displayed"
}, function (response) {
console.log(response);
});
});
我点击分享按钮,一个 iframe 打开,它抛出这个错误:
Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.
有什么想法吗?
【问题讨论】:
-
您是否尝试过按照建议包含域?
-
我确实包含了
Valid OAuth redirect URIs,我不能包含本地主机域