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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -