Within my AngularJS application, I am utilizing the Facebook SDK.
When I trigger FB.logout()
upon clicking the logout button, it functions correctly:
$scope.logout = function() {
FB.logout()
}
However, I also aim to log out from Facebook when the window is closed. For this, I have implemented the following code:
$window.onbeforeunload = function() {
FB.logout()
}
The above code appears to be consistent with the previous implementation. Surprisingly, the second approach does not yield the expected results.
I am seeking insights on why this discrepancy exists and how I can rectify it. Any assistance would be greatly appreciated. Thank you!