如何防止HTML5页面缓存? [英] How to prevent html5 page from caching?

查看:513
本文介绍了如何防止HTML5页面缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用响应式布局将普通的香草HTML页面转换为HMTL5 / CSS3,出于安全原因(由安全人员指定),页面绝不能缓存。



先前使用过的页面< meta http-equiv =Pragmacontent =no-cache> < meta http-equiv =Expirescontent = - 1> ,以防止页面被缓存。


如何防止html页面在客户端缓存?

我花了一周的时间阅读清单文件,但它们看起来与我想要的完全相反,因为明确附加清单文件会导致它附加的页面缓存。

请不要将我引回到现在允许使用元元素的w3c定义 - 我知道HTML5不包含缓存-control Pragma meta 元素中。



我需要知道它所包含的内容会阻止页面被缓存。

解决方案

 <!DOCTYPE html>在开始的代码中,您需要使用此代码:


< html manifest =manifest.appcache>
...

然后创建 manifest.appcache 带有这样的内容:

 
CACHE MANIFEST

#缓存清单版本1.0

#无缓存

网络:
*


I converted a plain vanilla HTML page to HMTL5/CSS3 with a responsive layout, and for security reasons (dictated by the security people) the page must never cache.

The page previously used <meta http-equiv="Pragma" content="no-cache"> and <meta http-equiv="Expires" content="-1"> to prevent the page from being cached.

What replaces this in HTML5? How do you prevent an html page from caching in the client?

I've spent a week reading about manifest files, but they seem to do exactly opposite of what I want as attaching a manifest file explicitly causes the page it is attached to to cache.

And please don't refer me back to the w3c definition of which meta elements are now allowed — I understand that HTML5 does not include the cache-control or Pragma in meta elements.

I need to know what it does include that will prevent a page from being cached.

解决方案

In the beginning of code you need to use this:

<!DOCTYPE html>
<html manifest="manifest.appcache">
...

Then create manifest.appcache with such content:

CACHE MANIFEST

# Cache manifest version 1.0

# no cache

NETWORK:
*

这篇关于如何防止HTML5页面缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆