html5 meta tag cache-control no longer valid?

前端 未结 4 1426
抹茶落季
抹茶落季 2020-12-08 19:40

How do I define


in HTML5? It is no longer valid according to the W3C Vali

4条回答
  •  长情又很酷
    2020-12-08 20:12

    In the beginning of code you need to use this:

    
    
    

    ...

    Then create cache.manifest file with content of what you want to cache i.e

    CACHE MANIFEST
    # 2010-06-18:v2
    
    # Explicitly cached 'master entries'.
    CACHE:
    /favicon.ico
    index.html
    stylesheet.css
    images/logo.png
    scripts/main.js
    
    # Resources that require the user to be online.
    NETWORK:
    *
    
    # static.html will be served if main.py is inaccessible
    # offline.jpg will be served in place of all images in images/large/
    # offline.html will be served in place of all other .html files
    FALLBACK:
    /main.py /static.html
    images/large/ images/offline.jpg
    

    A manifest can have three distinct sections: CACHE, NETWORK, and FALLBACK.

    CACHE: This is the default section for entries. Files listed under this header (or immediately after the CACHE MANIFEST) will be explicitly cached after they're downloaded for the first time.

    NETWORK: Files listed in this section may come from the network if they aren't in the cache, otherwise the network isn't used, even if the user is online. You can white-list specific URLs here, or simply "", which allows all URLs. Most sites need "".

    FALLBACK: An optional section specifying fallback pages if a resource is inaccessible. The first URI is the resource, the second is the fallback used if the network request fails or errors. Both URIs must from the same origin as the manifest file. You can capture specific URLs but also URL prefixes. "images/large/" will capture failures from URLs such as "images/large/whatever/img.jpg".

提交回复
热议问题