Techniques for WCAG 2.0

Skip to Content (Press Enter)


FLASH19: Providing a script that warns the user a time limit is about to expire and provides a way to extend it


This technique relates to:

User Agent and Assistive Technology Support Notes

See User Agent Support for Flash for general information on user agent support.


The objective of this technique is to notify users that they are almost out of time to complete an interaction. When scripts provide functionality that has time limits, the script can include functionality to warn the user of imminent time limits and provide a mechanism to request more time. 20 seconds or more before the time limit occurs, the script provides a confirm dialog that states that a time limit is imminent and asks if the user needs more time. If the user answers "yes" then the time limit is reset. If the user answers "no" or does not respond, the time limit is allowed to expire.

This technique involves time limits set with the setTimeout() method. If, for example, the time limit should be 60 seconds, you can set the time limit for 40 seconds (20 seconds less than the desired timeout) and show a confirm dialog. The confirm dialog sets a new timeout for the remaining 20 seconds. If the user requests more time, a new timeout is set. However, if the 20-second "grace period time limit" expires (meaning 60 seconds have now elapsed), the action appropriate for the expiry of the 60 second time limit in the original design is taken.


Example 1: Using ActionScript to offer a time limit extension before the timeout expires

This is a basic AS2 example of a time limit that can be extended by the user. An alert is shown after 40 seconds of inactivity, warning that the session is about to expire. The user is given 20 seconds to press the space bar or click on the "Yes" button. Note that the 40 second duration would be insufficient for most tasks and is artificially short for ease of demonstration.

Example Code:

import mx.controls.Alert;
import flash.accessibility.Accessibility;


var sessionTimeout;
var sessionNotificationTimeout;
var timeLimit: Number = 60000;
var sessionAlert: Alert;

testField.addEventListener("change", resetTimeout);

function resetTimeout() {
  sessionTimeout = setTimeout(endSession, timeLimit);
  sessionNotificationTimeout = setTimeout(showTimeoutAlert, timeLimit - 20000);

function showTimeoutAlert() {
  sessionAlert ="Click the YES button to extend your session",
  "Your login session is about to expire, do you need more time?",
  Alert.YES | Alert.NO, null, handleAlertClick);

function endSession() {
  sessionAlert.deletePopUp();"please log in again",
  "Your session has expired");

function handleAlertClick(e) {
  if (e && e.detail && e.detail == Alert.YES)

For a demonstration, see a working example of Using ActionScript to offer a time limit extension before the timeout expires. The source of Using ActionScript to offer a time limit extension before the timeout expires is available.



  1. load the page and start a timer that is 20 seconds less than the time limit.

  2. when the timer expires, check that a confirmation dialog is displayed warning of the impending time limit and allows the user to extend the limit within 20 seconds.

Expected Results

Check #2 is true

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.

Techniques are Informative

Techniques are informative—that means they are not required. The basis for determining conformance to WCAG 2.0 is the success criteria from the WCAG 2.0 standard—not the techniques. For important information about techniques, please see the Understanding Techniques for WCAG Success Criteria section of Understanding WCAG 2.0.