Facebook feed对话框不起作用 [英] Facebook feed dialog not working

查看:159
本文介绍了Facebook feed对话框不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Facebook Feed对话框在测试网站上工作,但是我仍然收到相同的错误消息:[app_name]发生错误,请稍后再试。
当我查看文档时,我意识到,该文档也不起作用。

I am trying to get the Facebook Feed dialog to work at a test site but I keep getting the same error message: "An error occurred with [app_name]. Please try again later.". When I look at the documentation I realize that the example in the documentation doesn't work either.

尝试了许多不同的解决方案。
这是我的测试代码:

Have tried a number of different solutions. Here is my test code:

 <html xmlns:fb="https://www.facebook.com/2008/fbml">
  <body>
  <div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    // init the FB JS SDK
    FB.init({
      appId      : '400714233333865', // App ID from the App Dashboard
      channelUrl : '//demo.xxxxxxx.se/nptest/channel.html', // Channel File for x-domain communication
      status     : true, // check the login status upon init?
      cookie     : true, // set sessions cookies to allow your server to access the session?
      xfbml      : true  // parse XFBML tags on this page?
    });

    // Additional initialization code such as adding Event Listeners goes here

  };

  function postToFeed(){

  FB.ui(
  {
   method: 'feed',
   name: 'The Facebook SDK for Javascript',
   caption: 'Bringing Facebook to the desktop and mobile web',
   description: (
      'A small JavaScript library that allows you to harness ' +
      'the power of Facebook, bringing the user\'s identity, ' +
      'social graph and distribution power to your site.'
   ),
   link: 'https://developers.facebook.com/docs/reference/javascript/',
   picture: 'http://www.fbrell.com/public/f8.jpg'
  },
  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
);

};

  // Load the SDK's source Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>



     <div id='fb-root'></div>
<a onClick="postToFeed('Text');">
    Share in the feeeeeeeeeeeeed
</a>
  </body>
</html>

有没有人遇到类似的问题或解决方案?

Has anyone come across a similar issue or a solution for this?

推荐答案

确保您正在通过应用程序设置中指定的相同URL进行测试。在您的Feed对话框中,提供自己的链接和图片,即您在应用程序设置中指定的自己的域的链接,而不是在Facebook示例中给出。

Make sure that you are testing through same URL as specified in Application settings. In your feed dialog give your own links and images i.e. links of your own domain specified in Application setting and not one given in Facebook example.

这篇关于Facebook feed对话框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆