Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

session timeout

Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application I have this session timeout javascript function and works well. I have to give timeout message to the user after 20 mins of inactivity. We have some applets also. But the timeout function gives the alert message even if the user is working on the applet. I understand that Browser and applet are two diffrent things, i guess thats why its not working properly. Is there a good way to implement this functionality in applets ?, please advice.


function ShowTimeoutWarning()
window.alert( "Your session has been timed out. As a security precaution, sessions are invalidated after 20 minutes of inactivity. You can log in again to resume.!" );

setTimeout( 'ShowTimeoutWarning();', 60000 );
Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could keep track of the time each time the user does something in the GUI; the event handlers would be a good place for this. If at some point the time since the last event is more than 20 minutes you can require a re-login.

But it sounds like you only want to time out if the user accesses neither the web page nor the applet - correct? For that you'd need to implement some kind of Java<-->JavaScript interaction; some hints on how to do that can be found here.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic