Technique H76:Using meta
refresh
to create an instant client-side redirect
About this Technique
This technique relates to 3.2.5: Change on Request (Sufficient when used with G110: Using an instant client-side redirect).
This technique applies to HTML.
Description
The objective of this technique is to enable redirects on the client side without confusing the user. Redirects are preferably implemented on the server side (see Implementing automatic redirects on the server side instead of on the client side), but authors do not always have control over server-side technologies.
In HTML, one can use the meta
element with the value of the http-equiv
attribute set to refresh
and the value of the content
attribute set to 0
(meaning zero seconds), followed by the URI that the browser should request. It is important that the time-out is set to zero, to avoid that content is displayed before the new page is loaded. The page containing the redirect code should only contain information related to the redirect.
Examples
Example 1: Instantly redirecting a page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Panucci's Pizza</title>
<meta http-equiv="refresh" content="0; URL=https://planet-express.example.com">
</head>
<body>
<p>This page has moved to <a href="https://planet-express.example.com">
Planet Express</a>.</p>
</body>
</html>
Related Resources
No endorsement implied.
Tests
Procedure
Find all meta
elements in the document that contain the http-equiv
attribute with value refresh
, check that:
- the
content
attribute has a number with a value of0
, and - the number is followed by
;URL=anyURL
(where anyURL stands for the URI that should replace the current page).
Expected Results
Steps #1 and #2 are true.
Test Rules
The following are Test Rules related to this Technique. It is not necessary to use these particular Test Rules to check for conformance with WCAG, but they are defined and approved test methods. For information on using Test Rules, see Understanding Test Rules for WCAG Success Criteria.