HTML5 Cache Manifest and Content types

2020-07-11 05:04发布

问题:

i am reading Dive into HTML5: Offline web apps: Cache manifest

... but it must be served with the content type text/cache-manifest. If you are running an Apache-based web server, you can probably just put an AddType directive in the .htaccess file at the root of your web directory

AddType text/cache-manifest .manifest

if i dont add this what will happen? is the content type so important? i did a search for AddType in httpd.conf. but i dont see content-type for say html, js, images etc. it dont seem all that important after all?

回答1:

It's likely that if you don't have the content type set correctly the browsers will refuse to treat it as a manifest file, similar to the well known Firefox problem where stylesheets get ignored if served with a plain text MIME type.

The content types of your Apache server are possibly not in httpd.conf, they are usually stored in another configuration file mime.types (by default, though it can be changed).