1

我想知道在使用发布到墙弹出对话框后是否可以将某人重定向到不同的选项卡 url。

当前发布到墙上的脚本。

<script type="text/javascript">
window.fbAsyncInit = function() {
  FB.init({appId: APPID,
              status: true,
              cookie: true,  
              xfbml: true});  };  
     (function() {
         var e = document.createElement('script');
         e.async = true;  
         e.src = document.location.protocol +  
         '//connect.facebook.net/en_US/all.js';
         document.getElementById('fb-root').appendChild(e);
     }());
 </script>

<script>
function publish_to_wall(){
   FB.ui({ 
     method: 'stream.publish',
     display: 'iframe',
     name: ('some text ') + (document.getElementById('myText').value) +(' some text'),
     caption: 'some caption',
     link: 'some url',
     picture:'some image url'
   });
 }
</script>

重定向必须在 iframe 内进行。所以在有人将帖子发布到他/她的墙上后,人们会被重定向到感谢页面。

4

1 回答 1

2

像这样的东西?

feedData = {};
feedData.method = 'feed';
feedData.name = "title";
feedData.link = "url";
feedData.picture = "url to picture";

FB.ui(feedData,function(feedResponse) {
    if (response && response.post_id) {
        alert('Post was published.');
        //do redirect
window.location = "url to thank you page"
    } else {
        alert('Post was not published.');
    }

});
于 2012-01-04T16:50:13.133 回答