HTML Guides for pragma
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The Pragma HTTP header is a holdover from HTTP/1.0, originally used to instruct proxies and browsers not to cache a response. In older HTML specifications, developers sometimes placed <meta http-equiv="Pragma" content="no-cache"> in their documents, hoping browsers would treat it like a real HTTP header. However, the HTML living standard (maintained by WHATWG) restricts the http-equiv attribute to a small set of recognized values: content-type, default-style, refresh, x-ua-compatible, and content-security-policy. The value Pragma is not among them, which is why the W3C validator flags it as invalid.
Beyond the validation error, this approach has always been unreliable. Browsers and caching proxies generally ignore http-equiv meta tags for cache control purposes — they rely on actual HTTP response headers sent by the server. Keeping this invalid tag in your HTML provides a false sense of security while producing no real caching benefit.
Why this is a problem
- Standards compliance: Using an unrecognized http-equiv value produces invalid HTML that fails W3C validation.
- No practical effect: Most browsers and all intermediary proxies (CDNs, reverse proxies) ignore cache directives embedded in <meta> tags. Only real HTTP headers reliably control caching behavior.
- Misleading code: Developers maintaining the codebase may assume caching is properly managed in HTML when it isn’t, leading to unexpected caching issues in production.
How to fix it
- Remove the invalid <meta> tag from your HTML <head>.
- Configure caching via HTTP response headers on your server. Set Cache-Control (and optionally Pragma for HTTP/1.0 compatibility) as actual headers in your server configuration or application code.
For example, in an Apache .htaccess file:
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Or in an Nginx configuration:
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
These server-side headers are the correct and effective way to manage caching.
Examples
Incorrect: using Pragma in http-equiv
This triggers the validation error:
<head>
<meta charset="utf-8">
<meta http-equiv="Pragma" content="no-cache">
<title>My Page</title>
</head>
Incorrect: using Cache-Control in http-equiv
While Cache-Control is also sometimes seen in <meta> tags, it is not a valid http-equiv value in the HTML standard either, and browsers largely ignore it:
<head>
<meta charset="utf-8">
<meta http-equiv="Cache-Control" content="no-cache">
<title>My Page</title>
</head>
Correct: remove the invalid tag and use server headers
Simply remove the caching meta tag. Your HTML stays clean and valid:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My Page</title>
</head>
<body>
<p>Cache control is handled by server-side HTTP headers.</p>
</body>
</html>
Then configure your web server to send the appropriate Cache-Control and Pragma HTTP response headers as shown in the server configuration examples above. This is the only reliable way to control how browsers and proxies cache your pages.
Ready to validate your sites?
Start your free trial today.