2012-11-13 53 views
-1

我创建了一个类似按钮的标签。 作为所有人;)我想订阅或取消订阅页面后刷新整个页面...失败的Facebook页面刷新onclick像按钮(部分解决)

任何想法?

------- ------编辑我 已经修改我的代码加入互联网上找到一些代码(6个小时的测试,我是一个坏的编码器...) 下面这段代码的工作下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> 

回答

-1

我觉得你在你的代码留下效应初探,

试试下面的代码

 FB.Event.subscribe('edge.create', function(response) { 
      window.top.location = "http://google.com"; 
     }); 
+0

谢谢你这是工作,但我的Firefox下测试它,它是不工作...做你有想法解决这个问题吗? –

+0

你调试过吗?因为代码似乎是正确的。 – luschn

+0

是的,我把我的url在fb调试,它说“fb:admins和fb:app_id标签丢失”+ og:title,og:image .. –