【问题标题】:Facebook js-sdk share button from localhost来自本地主机的 Facebook js-sdk 共享按钮
【发布时间】: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,我不能包含本地主机域

标签: facebook-javascript-sdk


【解决方案1】:

here 所述,您可能需要稍微调整一下您在 facebook 中的设置。

【讨论】:

  • hmmm,也许我需要添加localhost作为站点url,不知道我试过没有让,我会再试一次。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-14
  • 2013-11-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多