I have developed a simple chat application where I am using the $window.onbeforeunload
to notify other users when somebody closes the tab/browser (basically when the user leaves the room).
Here is my code
$scope.onExit = function() {
$scope.chatstatus.$add({
status: $scope.getUsername + ' left'
});
};
$window.onbeforeunload = $scope.onExit;
This is working absolutely fine on desktop browsers but not on the Android Chrome browser. The onbeforeunload
function is not getting triggered at all.
Please suggest a solution/workaround. Thanks.
EDIT: As mentioned in the comments that it is a known issue, kindly suggest a workaround if not the solution.