Portal user idle timeout using dialog windows – Client side solution
Background of previous Solution :
If user is idle, then the Portal displays a warning message to the user after a certain period (warning period). In the duration between warning period and actual timeout period, if user intervens and clicks on the Warning message, then Portal timer is updated. Else the Portal still remains idle waiting for user intervention. Hence the actual timeout of the application is happenning only after user intervention. Even if the user has not seen the application for n hours the portal would not have logged off.
Hence to overcome this issue, in place of an alert I have used a dialog window prompting the user to activate the portal and will be displayed for few minutes (timeout period – warning period) after which it closes automatically and logs off the portal. Before logging off it opens a new window informing the user about the session termination due to inactivity. The code has been modified for achieving the same.
Open Mashead PAR file through NWDS.
Create a JS page by name customtimeout.js under scripts folder in the project directory and include the same in Headerivew.jsp page.
Add the below code in customtimeout.js
For opening a pop up dialog window in Internet Explorer browser after the warning period, create a JSP page by name IEDialog.JSP and add the below code in it .
For opening a pop up dialog window in other browsers after the warning period, create a JSP page by name FFDialog.JSP and add the below code in it .
To display a Logoff message after Portal Log off, create a JSP page by name LogoffMessage add the below code in it .
The Log off Message is displayed, so that user can identify that its a force log off due to session inactivity. The HTML code for the same is given below.
Add the below code towards the end of HeaderiView.jsp
(No change done in this page compared to previous)
Note: The Idle warn delay & kick delay values can be changed as per the requirement in
customTimeoutHandler(25, 30) in HeaderiView.jsp.
After being idle on the portal for 25 minutes , you should obtain a popup like the following:
Log off message after timeout:
It worked for me. Hope you’ll find it useful.