Require meta refresh to have 0 second delay

Rule ID:
meta-refresh
Category:
Accessibility
Standards:
  • WCAG 2.2 (A)
  • WCAG 2.1 (A)
  • WCAG 2.0 (A)

The <meta http-equiv="refresh" content=".."> directive can be used to refresh or redirect the page. For users with assistive technology a forced refresh or redirect after a fixed duration can render the user unable to read and understand the content in time.

Generally the directive should be avoided all together but under some situations it is unavoidable (e.g. a static page generator hosted on git-based hosting solutions don't provide an alternative for server-based redirection are forced to use client-side redirection).

WCAG H76 requires the interval to be set to exactly 0 as to do theredirection before any content is rendered to the client.

This rule prevents non-zero time intervals and using the directive to refresh the page as it would be stuck in an infinite loop refreshing the same page over and over again.

Rule details

Examples of incorrect code for this rule:

<meta http-equiv="refresh" content="5;url=target.html">
error: Meta refresh must be instant (0 second delay) (meta-refresh) at inline:1:37:
> 1 | <meta http-equiv="refresh" content="5;url=target.html">
    |                                     ^^^^^^^^^^^^^^^^^


1 error found.

<meta http-equiv="refresh" content="0">
error: Don't use instant meta refresh to reload the page (meta-refresh) at inline:1:37:
> 1 | <meta http-equiv="refresh" content="0">
    |                                     ^


1 error found.

Examples of correct code for this rule:

<meta http-equiv="refresh" content="0;url=target.html">

Options

This rule takes an optional object:

{
  "allowLongDelay": false
}

allowLongDelay

Delays longer than 20 hours is exempt from WCAG Success Criterion 2.2.1 Timing Adjustable. By enabling this option the refresh delay can be set to a value greater than 72000.

With this option disabled:

<meta http-equiv="refresh" content="72001">
error: Meta refresh must be instant (0 second delay) (meta-refresh) at inline:1:37:
> 1 | <meta http-equiv="refresh" content="72001">
    |                                     ^^^^^


1 error found.

With this option enabled:

<meta http-equiv="refresh" content="72001">

References

Version history