htmldirectivespecificationsforward-compatibilityhttp-equiv

Are there HTML5 compliant alteratives to the http-equiv Cache-Control and Pragma directives?


I am updating the HTML of a site to be HMTL5 compliant. The existing site has the following two meta http-equiv elements:

Are these two HTML5 compliant? If not, what should I replace these with in order to make my site HTML5 compliant?

I found this link that lists down the valid http-equiv pragmas:

http://www.w3.org/TR/html5/document-metadata.html#attr-meta-http-equiv

It does not include Cache-Control or Pragma in the list.

Thanks in advance.


Solution

  • Cache related pragmas are non-compliant:

    Pragma directives corresponding to headers that affect the HTTP processing model (e.g. caching) must not be registered, as they would result in HTTP-level behaviour being different for user agents that implement HTML than for user agents that do not.

    There is no alternative in HTML5.

    Here are the relevant http-equiv pragmas for HTML5:

    The http-equiv attribute is an enumerated attribute. The following table lists the keywords defined for this attribute. The states given in the first cell of the rows with keywords give the states to which those keywords map. Some of the keywords are non-conforming, as noted in the last column.

    State                       Keyword                 Notes
    
    Content Language            content-language        Non-conforming
    Encoding declaration        content-type    
    Default style               default-style   
    Refresh                     refresh     
    Cookie setter               set-cookie              Non-conforming
    X-UA-Compatible             x-ua-compatible     
    Content security policy     Content-Security-Policy     
    

    References