Endless loop when starting pre-created facebook application from Heroku

If you register the facebook application and use the Heroku service, it will create an example application for you, since an infinite loop has arisen from a few days ago and you cannot interact with your application. I tried replacing window.location = window.location; with window.top.location.href = "https://apps.facebook.com/xxxxxx":

//Listen to the auth.login which will be called when the user logs in
//using the Login button
FB.Event.subscribe('auth.login', function(response) {
// We want to reload the page now so PHP can read the cookie that the
// Javascript SDK sat. But we don't want to use
// window.location.reload() because if this is in a canvas there was a
// post made to this page and a reload will trigger a message to the
// user asking if they want to send data again.
//window.location = window.location;
window.top.location.href = "https://apps.facebook.com/YOUR_APPs_NAMESPACE"
});

Fortunately, he solved the problem. Just sharing here.

+5
source share

All Articles