HTML5:为什么我需要将清单文件添加到 .htaccess?
我看过一些关于 HTML5 Manifest 的文章,其中说我们必须将清单文件添加到 .htaccess 中,并添加以下行:
AddType text/cache-manifest .manifest
但是,没有任何说明添加的目的是什么? 我应该将该 .htaccess 文件放在哪里?在清单文件所在的同一文件夹中?最后我如何确保它成功添加到 .htaccess 中?
即使我不创建任何 .htaccess 文件,我只将其添加到我的 html 文件中,
<html manifest="site.manifest">
我可以在 Firefox 中看到弹出栏,询问网站要求存储数据。那么没有这个 .htaccess 就不能工作吗? 如果有人可以解释,我会很感激。谢谢。
I have seen some articles about HTML5 Manifest, which say that we must add manifest file to .htaccess with following line:
AddType text/cache-manifest .manifest
However, there is no any explnation what is the purpose of adding?
Where should I place this .htaccess file ? in the same folder where the manifest file is? and finally how can i make sure that it is added to .htaccess successfully?
Even if i do not create any .htaccess file, i only add this to my html file
<html manifest="site.manifest">
I can see the popup bar in firefox, asking that the website is asking to store data. So isn't it working without this .htaccess?
I'll appriciate if anyone can explain. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不会使用该行将清单文件“添加到 .htaccess”。该行只是告诉 Apache 后缀为“.manifest”的文件将属于
text/cache-manifest
类型。 Apache 在 HTTPcontent-type
标头中告诉客户端有关文件类型的信息。浏览器/客户端需要 HTTPcontent-type
标头来了解如何解释文件的内容。请参阅:You don't "add a manifest file" to .htaccess with that line. That line just tells Apache that files with the suffix ".manifest" will be of type
text/cache-manifest
. Apache tells the client about the file type in the HTTPcontent-type
header. The HTTPcontent-type
header is required for the browser/client to understand how to interpret the contents of the file. Refer: