Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Using JS Alert does not timeout until OK is Clicked #223

Open
chetanc97 opened this issue Jul 10, 2019 · 1 comment
Open

Using JS Alert does not timeout until OK is Clicked #223

chetanc97 opened this issue Jul 10, 2019 · 1 comment

Comments

@chetanc97
Copy link

chetanc97 commented Jul 10, 2019

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.");
});
});

@ericnewton76
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants