fb.ui error "An error occurred. Please try again later."

1.6k views Asked by At

Hey guys I have a script I'm using to share a post from my website, on facebook. I'm using the fb.ui sdk, and keep getting this error:

"An error occurred. Please try again later.".

It is set to pop up when the page loads.

I noticed that the app_id has no id in the secure url that facebook generates for the pop up. Is this because it is hidden, or is it not being sent? Here is a clipping of the URL:

"https://www.facebook.com/dialog/feed?app_id=&caption=Info&"

Here is my code:

index.php:

<html>
<head>
  <title>Post to Facebook</title>
  <script src="http://connect.facebook.net/en_US/all.js"></script>
</head>


<body>
  <div id="fb-root"></div>
   <script>
     window.fbAsyncInit = function() {
       FB.init({
         appId      : '1404387053111932',
         channelUrl : 'http://website.com/fb/channel.html',
         status     : true,
         xfbml      : true
      });
   };


  (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/all.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

</body>


<script>
FB.ui(
  {
    method: 'feed',
    name: 'Facebook Dialogs',
    link: 'http://www.website.com',
    picture: 'http://www.website.com/images/logo.png',
    caption: 'Info',
    description: 'InfoInfoInfo'
  },
  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
);
</script>

Channel.html:

<script src="http://connect.facebook.net/en_US/all.js"></script>

Any help is appreciated!

0

There are 0 answers