0

我想在用户在 facebook 上分享后将他们重定向到特定页面,我在这里找到了一个很好的答案:

facebook分享和发布后重定向用户

这是脚本

<script type="text/javascript">
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
  function share_me() {
    FB.ui({
      method: 'feed',
      app_id: 'YOUR_APP_ID',
      link: 'SHARE_URL',
      picture: 'PIC_URL',
      name: 'SHARE_NAME',
      caption: 'SHARE_CAPTION',
      description: 'SHARE_DESCRIPTION'
    },
    function(response){
      if(response && response.post_id) {
        self.location.href = 'SUCCESS_URL'
      }
      else {
        self.location.href = 'CANCEL_URL'
      }
    });
  }
</script>";
  <div onclick="share_me()">Share</div>

但是当我使用脚本时,根本没有重定向,即使用户点击“取消”,请帮我解决这个问题,因为我从 1 周开始就在寻找这样的方法!

4

1 回答 1

0

尝试使用另一个 javascript 函数进行重定向,例如 window.location = "YOUR_PAGE"

于 2012-06-27T15:23:31.107 回答