以上所有答案都不起作用(僅重定向到頁面流)或現在不推薦使用。你正在使用JS最好的解決辦法:
// called when like button, box, etc is rendered
FB.Event.subscribe("xfbml.render", function() {
// assigns click to that thing
FB.Event.subscribe("edge.create", function(response) {
window.location.reload(); // reload frame only
});
});
您還可以加載和初始化Facebook的JS SDK。如果你不知道如何去做,使用這個:
<script>
document.onload = function(){
(function(d){
var js,id='facebook-jssdk';
if(d.getElementById(id)){return;}
js=d.createElement('script');
js.id=id;js.async=true;js.src="//connect.facebook.net/pl_PL/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
window.fbAsyncInit = function(){
FB.init({
appId : <PASTE_YOUR_APP_ID_HERE>,
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe("xfbml.render", function() {
FB.Event.subscribe("edge.create", function(response) {
window.location.reload();
});
});
}
}
</script>
...是的,但這需要提前頁面id(硬編碼)...它不是一個動態的解決方案。 – Paul 2010-04-12 10:25:13