Ensure <meta http-equiv="refresh"> is not used for delayed refresh
Rule ID: meta-refresh-no-exceptions
User Impact: minor
Guidelines: Best Practices
The meta-refresh-no-exceptions
rule ensures that
pages do not use the <meta http-equiv="refresh">
element, as it can cause accessibility issues by refreshing or redirecting pages without user control.
What is being tested?
This rule checks that:
- No
<meta http-equiv="refresh">
element is present on the page. - Pages do not automatically refresh or redirect using the
meta
tag.
Why it matters
Automatic refresh or redirection can be disorienting and frustrating, especially for people with disabilities. It can:
- Move focus away from where the user was interacting, often back to the top of the page.
- Interrupt screen readers or assistive technologies, causing confusion.
- Leave users without control over the refresh or redirect timing, creating barriers for people who need more time to process content.
How to fix the problem
- Remove the
http-equiv="refresh"
attribute from allmeta
elements. - If page refresh or redirection is necessary:
- Use JavaScript with options to pause, extend, or stop the refresh.
- Handle redirection server-side to avoid client-side disruption.
Incorrect example
<meta http-equiv="refresh" content="40; url=http://www.yourdomain.com/index.html">
Correct approach
// Use JavaScript to refresh, with user controls <script> // Provide a button to manually trigger refresh </script>
Best practices
- Never rely on
meta refresh
for critical page behavior. - Provide users with control over timed updates or redirects.
- When redirecting, use proper HTTP server-side redirects (e.g., 301, 302) to avoid impacting client-side accessibility.
Other Rules
Interested in other web accessibility rules? Please see these other rules: