最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Facebook dialog appears but always says "An error has occurred" - Stack Overflow

programmeradmin3浏览0评论
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ".dtd">
<html xmlns="" xmlns:fb="">

...

<head>

...

<script src=".js#xfbml=1"></script>
</head>
<body>
<div id="fb-root"></div>
<fb:like id="fb-like" href="" 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: ''
     },
     action_links: [
       { text: 'Code', href: '' }
     ],
     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?

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

...

<head>

...

<script src="http://connect.facebook/en_US/all.js#xfbml=1"></script>
</head>
<body>
<div id="fb-root"></div>
<fb:like id="fb-like" href="http://www.example." 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./facebook/connect-js'
     },
     action_links: [
       { text: 'Code', href: 'http://github./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?

Share Improve this question asked Dec 16, 2010 at 18:17 Conor JamesConor James 311 silver badge2 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

"This dialog is a replacement for the old www.facebook./connect/prompt_feed.php endpoint and www.facebook./connect/uiserver.php?method=stream.publish"

http://developers.facebook./docs/reference/dialogs/feed/

As you see, you're using deprecated stuff.

That it's deprecated doesn't matter, the issue is that you don't have permission to perform the action. Make sure your FB.login call requests publish_stream and it'll be fine.

I ran into an issue where the site logins were requesting this, but if the user wasn't logged into the site at this point it would do a

Have you registered the app with FB.int()? Info here

发布评论

评论列表(0)

  1. 暂无评论