About a month ago or something i encountered this behaviour on code that has been working this far. Whenever someone log-in via facebook, each page will reload extra one time.
For example user loads up index.php page then after javascript code fires page reloads once more, then after that it won't. So basically when you click link or refresh current page it reloads 2 times in total (1 from natural load and another from FB javascript)
The javascript code that has been giving problem i belive is:
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
Why this reloads on each page refresh? Before it worked perfectly only on user login 1 time.
I have regular additional code in html:
xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"
And javascript include right un开发者_如何学编程der body:
<div id="fb-root"><script src="http://connect.facebook.net/en_US/all.js"></script></div>
Fixed - by following this post FB.Event.subscribe('auth.login', function(response) { }) issue
Reference to working example - http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
Note: Make sure you include oauth : true in your FB.init settings.
精彩评论