ng-idle icon indicating copy to clipboard operation
ng-idle copied to clipboard

Using JS Alert does not timeout until OK is Clicked

Open chetanc97 opened this issue 5 years ago • 1 comments

I am using ng-idle in my Angularjs 1.5.x . I am warning the user that his/her Session expires with a alert() box . When i do this the timeout does not trigger until the alert is responded to . app.run(function ($rootScope, Idle) { Idle.watch(); $rootScope.$on('IdleTimeout', function () { // end their session and redirect to login. console.log('Session expired'); globalThis._adalInstance.logOut(); }); $rootScope.$on('IdleStart', function () { console.log('IDLE'); alert("Your session is about to expire. Please click anywhere on the page to avoid being logged out."); }); });

chetanc97 avatar Jul 10 '19 15:07 chetanc97

I think that is a browser limitation, while the alert box is displayed the thread is held in suspension. This is why you shouldn't use alert boxes in modern UI javascript code.

ericnewton76 avatar Aug 21 '20 14:08 ericnewton76