grbsk / ng-idle

Responding to idle users in AngularJS applications.
http://hackedbychinese.github.io/ng-idle
MIT License
564 stars 195 forks source link

What if window closes while logged in #208

Open alexandroscgb opened 7 years ago

alexandroscgb commented 7 years ago

Just a question. I'm using localStorageService to store user credentials so the session persists on multiple tabs in same window and different windows of the same browser, offering persistent session even if the window closes; only close session button or timing out using this library effectively closes the session.

Is it possible to keep on watching the idle time while there is no window or tab? I log in, close the window or tab and wait the time set for the timeout. When I open the window again, should the session be closed or open? I think that maybe because there is no context, no browser data at all? This library would start the countdown again, right?

Thanks.

grbsk commented 7 years ago

You are correct, it's session-based so when the browser closes, all the idle information goes again. When going back to the site, you'll have to start watching again and it'll be starting a new session.

There currently isn't support for a permanent session. I suppose it could be possible by letting you choose to use localStorage instead of sessionStorage.