Version 2.x, using stylesheets instead of popup windows, can be found here. Version 1.0 (this page) is not recommended because popup blockers will block the warning windows!
These scripts are meant to be used with the WebVoyage product by Endeavor Systems, Inc.™
WebVoyage has a timeout "feature" in which the product, unbeknownst to the user,
will log itself out after a certain amount of time. When the user attempts to use the product
after the designated time, they are sent to an error page from which they must restart the product.
The javascripts and html enclosed in timeout.zip are meant to
warn the user, via popup windows, before the end of the session timeout, giving the user a chance to restart the timer.
If the user takes no action before the session timeout, the popup window informs the user, giving them a chance to
begin a new search or to log in. If no action is taken, the page redirects to the home page after a predetermined amount of time.
The session counts down in the status bar of the browser, so users can see how much time is left at any time (provided their status bar is active.)
|
When the banner image in the header loads, the onLoad="showtimeout();" call is made.
(I didn't have access to the <body> tag, which is why we call an onLoad() method in the banner image.)
The showtimeout() function is located in timer.js.
The showtimeout() function continues to call itself and to count down until the remindtime.
At that point, it calls openWindow(), also located in timer.js, which opens the popup window.
The popup window, called timeout.html, has its own javascripts, located in /js/timeout.js
When timeout.html loads, it calls two functions: onLoad="showTime();" and onBlur="window.focus();"
The showTime() functions takes the time that is already being counted down and displays it.
The window.focus() function is used to keep the popup window in the front.
If the user clicks the "Restart Session" button, the reloadParent() function is called.
The reloadParent() function refreshes the library page, which resets WebVoyage, and closes the popup window, restarting the whole process.
If the user clicks the "New Session" button, the newSearch() function is called.
The newSearch() function sends the library page to the designated URL and closes the popup window.
The popup window called timedout.html has its own javascripts in /js/timedout.js
When the time has run out and no action was taken, the popup window loads timedout.html.
The timedout.html file calls two functions: onLoad="showRestartTimeout();" and onBlur="window.focus();"
The showRestartTimeout() function counts down the time to when the page will reload on the homepage.
It continues to call itself until either the clock runs out or the user takes action.
The window.focus() function is used to keep the popup window in the front.
|
Questions can be sent to Jim Robinson at Tarrant County College (jim.robinson[spamkill]@tccd.edu)
Some hints about debugging javascripts:
- If something isn't working, try putting an alert message in the function to see if the code is being reached. For example:
function testFunction() {
alert("here");
other code...;
}
- If the code isn't being called, check the syntax, the path to the javascript source, and your objects.
Don't be afraid to stick an object in an alert message to make sure it's an object!
- Download an Opera browser (http://www.opera.com) and turn on "Report JavaScript Errors".
Download a Firefox browser (http://www.mozilla.org) and open the JavaScript console under Tools.
- Remember: browser detection is poor coding...object detection will serve you much better.
|