Facebook在localhost上共享测试

时间:2016-11-30 02:08:22

标签: facebook facebook-graph-api facebook-javascript-sdk

我加载了FB SDK并具有以下功能(如下所示)以尝试分享到Facebook。

   $(document).on("click",".xxx",function(event) {
      FB.ui(
          {
             method: 'share',
             href: 'http://localhost:8000',// The link in feed method
             title: 'Testing',  // The same than name in feed method
             picture: 'http://localhost:8000/static/images/l.jpg',  
              caption: 'caption',  
              description: 'Test description',
           },
           function(response){
              // your code to manage the response
           });
   });

失败并显示以下错误消息:

enter image description here

我知道FB无法读取我的localhost来检索它可能需要的任何值。有谁知道如何让这个用于测试目的。或者在这一点上获得现场环境会更容易吗?

1 个答案:

答案 0 :(得分:0)

我使用ngrok 将我的本地笔记本模拟为服务器,它允许其他人通过Internet访问我的本地Web应用程序,并且对我有用,以度过开发时间。

因此,ngrok可能是您的选择之一。