发布后从iframe重定向到wall

Redirect after publish to wall from iframe

本文关键字:重定向 wall iframe      更新时间:2023-09-26

我想知道是否有可能在使用发布到墙弹出对话框后将某人重定向到不同的标签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内,所以当有人在他/她的墙中发布文章后,人们会被重定向到一个感谢页面。

像这样?

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.');
    }
});