Facebook dialog appears but always says "An error has occurred"

Posted by Conor James on Stack Overflow See other posts from Stack Overflow or by Conor James
Published on 2010-12-16T18:17:16Z Indexed on 2011/03/15 8:10 UTC
Read the original article Hit count: 207

Filed under:
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

...

<head>

...

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
</head>
<body>
<div id="fb-root"></div>
<fb:like id="fb-like" href="http://www.example.com" layout="button_count" show_faces="false" width="100"></fb:like>

...

myscript.js:

FB.ui(
   {
     method: 'stream.publish',
     message: 'getting educated about Facebook Connect',
     attachment: {
       name: 'Connect',
       caption: 'The Facebook Connect JavaScript SDK',
       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.'
       ),
       href: 'http://github.com/facebook/connect-js'
     },
     action_links: [
       { text: 'Code', href: 'http://github.com/facebook/connect-js' }
     ],
     user_message_prompt: 'Share your thoughts about Connect'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );

I have Facebook like button on my page which works fine.

But when I call the FB.ui method above from my JavaScript source, the Facebook dialog pops up but displays this error message:

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

This has happened repeatedly for two days since I started trying to implement it.

Not a very helpful error message.

Any idea what might cause it or how to narrow down the problem?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about facebook