Manage Learn to apply best practices and optimize your operations.

Domino SSO Timer: Updated version

This is an updated version of a tip that the user submitted in November 2004. The update will close a pop-under window when the parent window is closed.

This agent and JavaScript code will automatically create a pop-under window that waits x number of seconds before your SSO expiration time occurs. The agent has four constants and one variable for configuring the agent.

The agent constants are:
maxWait% -- An integer constant that must be set to the number of minutes to wait before a pop-up appears for the user to log in again. The value should be less than the SSO expiration time.
msgText$ -- A string constant that defines the text information that will appear in the body of the pop-under window.
titleText$ -- The string constant used to define the title of the browser's pop-under window.
fileName$ -- The string constant that defines the NSF file which contains the agent. (Include relative path information in the NSF name. For example, utilsMyNsfFile.nsf.)
popupText$ -- The string constant that defines the text which will appear in the alert message when the SSO expiration time -- maxWait% time elapses.
There is also a string variable called urlRedirect$. It contains the value "SSOTimer" as the name of the agent. Replace "SSOTimer" to the same name you gave to your agent that contains the code.

The agent should have the following settings:
When should this agent run? = Manually from agent list
Which document(s) should it act on? = Run once (@Commands may be used)

The agent will detect if it was called from a parent window. If so, focus will be returned to the parent window after the user responds to the alert message and logs onto the server again.

To call the agent and create the pop-under window, you will have to call the agent using some JavaScript code. I have Web applications that present the user with a navigator and an embedded view. Of course, the embedded view is contained in a form. That is where I added the onLoad JavaScript code.

The JavaScript code will set a cookie that has a life span of the Web session. If the cookie is not set, it assumes that the pop-under window needs to be loaded. You are not limited to using the JavaScript code in the onLoad event. Use it anywhere that makes sense as your known starting point into your Web application.

In summary, the process works as follows:
1. User logs into Web application and triggers the agent to run in a pop-under window.
2. The pop-under window waits for the specified period of time and then alerts the user with a user defined message.
3. User logs in with user name and password again (refreshingSSO expiration time).
4. Focus is returned to the parent window.

Three changes have been made to the updated version of this tip:
1. If a pop-under window remains after the parent is closed (an orphan), it will be closed before the new parent window creates the new pop-under window. This will ensure the child has a handle on the current parent.
2. The pop-under window will not attempt to show an alert box after the designated wait time if the parent is gone.
3. The login screen will resize to full-screen when it becomes visible and comes into focus.

LotusScript Code: 

Sub Initialize
 Const maxWait% = 115'Change to 
the desired number of minutes to wait
 Const msgText$ = "Single Sign-On Timer - 
Waits five minutes before the web session 
times out and pop-ups up to ask user to 
sign in again to prevent losing any information."
 Const titleText$ = "Domino Password Timer"
 Const fileName$ = "YourNotesDb.nsf" 
 Const popupText$ = "Your password will 
expire in five minutes.  Press OK to enter your 
user name and password again.  
This will prevent losing any information."
 Dim urlRedirect As String
 urlRedirect$ = fileName$  + "/?logout&redirectTo=" 
+ fileName$ + "/SSOTimer?openagent"
 Print "&lthead>"
 Print |&ltMETA HTTP-EQUIV='Refresh' CONTENT='| 
+ Trim(Cstr( maxWait% * 60 ) ) + |; URL=| +
 urlRedirect$ + |'></head>|
 Print "&ltTITLE>" + titleText$ + "</TITLE>" 
 Print |&ltBODY TEXT="000000" BGCOLOR="FFFFFF"
 if (document.all) {
 Print "else if (document.layers||document.getElementById) {"
 Print "if (top.window.outerHeight<
 Print |top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
var curDate = new Date();

if( ! opener.window.closed ) {alert( curDate + 
": | + popupText$ + |");}|
 Print |" onLoad="top.window.moveTo(0,0);
 if (document.all) {
 Print "else if (document.layers||document.getElementById) {"
 Print "if (top.window.outerHeight<
 Print |top.window.outerHeight = 0;
top.window.outerWidth = 300;
 if ( opener ) {
}">| _
+ msgText$ + "</body>"
End Sub

JavaScript Code:


function getPath() {
var curURL = "" + window.location;
var pos = curURL.indexOf(".nsf");
 //find the position var path = "";

if ( pos != -1 ) {
 path =  curURL.substring(0, pos) + ".nsf"; } else {
 var URLInfo = curURL.split( "/" );
 path = URLInfo[0] + "//" + URLInfo[2] + "/" + 

return path;


function setCookie(name, value, expires, path, domain, secure)
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");


function getCookie(name)
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
        begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
        end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));


if ( getCookie( "ssoTimer" ) == null ) {
 setCookie( "ssoTimer", "Y" );
 var agentName = "SSOTimer/?openagent";        
 var dbName = getPath();'','ssotimer').close(); 
//Close the child window in case it was
 orphaned and points to a parent that does not exist 
 ssoWin = + "/" + agentName , 
"ssotimer", "width=700,height=450,status=no, 
resizeable=yes, scrollbars=yes, menubar=no"); 

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Dennis Potts. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on Lotus Notes Domino Agents

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...