Techniques for WCAG 2.0

On this page:

-

# F58: Failure of Success Criterion 2.2.1 due to using server-side techniques to automatically redirect pages after a time-out

## Applicability

- Any server-side scripting language

- Content does not meet the exceptions in the Success Criterion for permitted time limits.

This failure relates to:

- Success Criterion 2.2.1 (Timing Adjustable)
  - How to Meet 2.2.1 (Timing Adjustable)
  - Understanding Success Criterion 2.2.1 (Timing Adjustable)

## User Agent and Assistive Technology Support Notes

The Refresh header is not defined in HTTP/1.1 or HTTP/1.0, but it is widely supported by browsers (tested in Firefox 1.0 and IE 6 on Windows).

## Description

Server-side scripting languages allow developers to set the non-standard HTTP header "Refresh" with a time-out (in seconds) and a URI to which the browser is redirected after the specified time-out. If the time interval is too short, people who are blind will not have enough time to make their screen readers read the page before the page refreshes unexpectedly and causes the screen reader to begin reading at the top. Sighted users may also be disoriented by the unexpected refresh.

The HTTP header that is set is `Refresh: {time in seconds}; url={URI of new location}`. It is also possible to omit the URI and obtain a periodically refreshing page, which causes the same problem. The HTTP header that is set is `Refresh: {time in seconds}`.

## Examples

### Failure Example 1

The following example is a failure because a timed server-side redirect is implemented in Java Servlets or JavaServer Pages (JSP).

Example Code:

    public void doGet (HttpServletRequest request, HttpServletResponse response)
          throws IOException, ServletException {
            response.setContentType("text/html");
    	PrintWriter out = response.getWriter();
    	response.setHeader("Refresh", "10; URL=TargetPage.html");
    	out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
    	 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
    	out.println("<html><head><title>Redirect</title></head><body>");
    	out.println("<p>This page will redirect you in 10 seconds.</p>");
    	out.println("</body></html>");
      }

### Failure Example 2

The following example is a failure because a timed server-side redirect is implemented in Active Server Pages (ASP) with VBScript.

Example Code:

     <% @Language = "VBScript" %>
     <% option explicit
     Response.Clear
     Response.AddHeader "Refresh", "5; URL=TargetPage.htm"
     %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
     …
     <!--HTML code for content that is shown before the redirect is triggered-->

## Resources

Resources are for information purposes only, no endorsement implied.

- Hypertext Transfer Protocol -- HTTP/1.0 (IETF Request for Comments 1945) (plain text)

- Hypertext Transfer Protocol -- HTTP/1.1 (IETF Request for Comments 2616) (plain text)

## Related Techniques

- F40: Failure of Success Criterion 2.2.1 and 2.2.4 due to using meta redirect with a time limit
- F41: Failure of Success Criterion 2.2.1, 2.2.4, and 3.2.5 due to using meta refresh with a time-out

## Tests

### Procedure

1. When a Web page is rendered, check to see if it automatically redirects to another page after some period of time without the user taking any action.

### Expected Results

- If such a redirect is found then this failure condition applies and content fails the Success Criterion.

- Top
- Contents
- Intro
- Previous: Failure F55
- Next: Failure F59