How do you autopublish with FB.UI?

前端 未结 1 826
慢半拍i
慢半拍i 2021-01-12 21:54

I have the stream_publish permission but it still pops up a dialog and there doesn\'t seem to be any way to pass in an autopublish bool (like it was before the graph api). <

相关标签:
1条回答
  • 2021-01-12 22:26

    http://www.takwing.idv.hk/tech/fb_dev/jssdk/learning_jssdk_12.html

    The following will autopublish if you have the permissions unlike FB.UI :)

    
    function publishPost(session) {
       var publish = {
         method: 'stream.publish',
         message: 'is learning how to develop Facebook apps.',
         picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
         link : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/',
         name: 'This is my demo Facebook application (JS SDK)!',
         caption: 'Caption of the Post',
         description: 'It is fun to write Facebook App!',
         actions : { name : 'Start Learning', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
       };
    
       FB.api('/me/feed', 'POST', publish, function(response) {  
           document.getElementById('confirmMsg').innerHTML = 
                  'A post had just been published into the stream on your wall.';
       });
    };  
    
    0 讨论(0)
提交回复
热议问题