-1

我创建了一个标签,其中有一个喜欢的按钮。和大家一样;)我想在订阅或取消订阅页面后刷新整个页面。

--------编辑------ 我修改了我的代码,添加了一些在互联网上找到的代码。下面的这段代码在 IE 和 Firefox 下工作,但取消订阅功能不起作用......你知道修复它的技巧吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Document sans titre</title>
</head>

<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    // init the FB JS SDK
    FB.init({
      appId      : 'My App ID', // App ID from the App Dashboard
      status     : true, // check the login status upon init?
      cookie     : true, // set sessions cookies to allow your server to access the session?
      xfbml      : true  // parse XFBML tags on this page?
    });

    // Additional initialization code such as adding Event Listeners goes here
    FB.Event.subscribe('edge.create',function () {
        top.location = "http://www.google.fr";
      });
        FB.Event.unsubscribe('edge.create',function () {
        top.location = "http://www.google.fr";
      });

  };


 // Load the SDK Asynchronously
    (function(d){
      var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement('script'); js.id = id; js.async = true;
      js.src = "//connect.facebook.net/fr_FR/all.js";
      ref.parentNode.insertBefore(js, ref);
   }(document));
</script>

<div style="overflow:hidden; width:60px">
        <div class="fb-like" data-href="my fan page" data-send="false" data-width="60" data-show-faces="false"></div>
</div>

</body>
</html>
4

1 回答 1

-1

我想你在你的代码中留下了响应,

试试下面的代码

        FB.Event.subscribe('edge.create', function(response) {
            window.top.location = "http://google.com";
        });
于 2012-11-13T23:04:49.340 回答