javascript - I want to Display Popup on tab close in angularjs? -
i'm trying display popup on tab/window close. if user clicks "leave page" cookies , session must cleared/destroyed. else if clicks on "stay on page". should normal such before ?
my code :
$rootscope.onexit = function() { $cookies.remove('isauthenticated'); $cookies.remove('current_user'); $rootscope.isloggedin = false; }; $window.onbeforeunload = $rootscope.onexit;
my code working properly means if window/tab closed deletes cookie the problem want done after popup result
try add code remove cookies , isloggedin unload event , assign empty function onbeforeload event
$rootscope.onexit = function() { $cookies.remove('isauthenticated'); $cookies.remove('current_user'); $rootscope.isloggedin = false; }; $window.unload = $rootscope.onexit; $window.onbeforeunload = function(){}
Comments
Post a Comment