Jason Phillips
Jason Phillips

Reputation: 3

Detect Facebook App Canvas Unloaded

I need to detect that a user unloads my Facebook app (navigates to somewhere else or logs out of Facebook). How can this be done? I have tried:

FB.Event.subscribe('auth.logout', function(response) {
    console.log('logged out');    
});

But this never fires :(

Upvotes: 0

Views: 149

Answers (1)

Rob Johnstone
Rob Johnstone

Reputation: 1734

why not try to listen to the window unload event rather than using the Facebook API:

window.addEventListener('unload', function(event) {
   console.log('Bye bye!');
});

This should catch the situations you need

Upvotes: 1

Related Questions