We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
第278天 如何禁止html页面缓存?
我也要出题
etag
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="0">
上面说清楚了如何禁止页面缓存,那我对这几个meta属性进行说明一下:
表示缓存控制,no-cache,no-store,must-revalidate,都表示不缓存的意思。 不过,Cache-Control是http1.1支持的。目前大多数http传输都是1.1的版本。
值设置为no-cache,和Cache-Control的意义是一样的。 区别:Pragma是http1.0支持的写法,所以这一句是为了兼容老版本的http传输协议。
值设置为0,表示过期时间,不进行缓存。
再额外补充一下,meta标签一些其他比较重要的设置。
表示用于显示窗口的设定
<meta http-equiv="Window-target" content="_top">
说明:这是一道常见的面试题,如何防止别人通过iframe嵌入自己的网页?
用来定义页面使用的语言。
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
用来表示移动端友好,让pc端展示的网页,在移动端也能有比较好的展示效果。
<meta name="viewport" content="width=device-width,initial-scale=1.0">
Activity
PullAndRun commentedon Jan 18, 2020
etag
leon0707 commentedon Jan 19, 2020
liwudi commentedon Jan 21, 2020
上面说清楚了如何禁止页面缓存,那我对这几个meta属性进行说明一下:
Cache-Control
表示缓存控制,no-cache,no-store,must-revalidate,都表示不缓存的意思。
不过,Cache-Control是http1.1支持的。目前大多数http传输都是1.1的版本。
Pragma
值设置为no-cache,和Cache-Control的意义是一样的。
区别:Pragma是http1.0支持的写法,所以这一句是为了兼容老版本的http传输协议。
Expires
值设置为0,表示过期时间,不进行缓存。
liwudi commentedon Jan 21, 2020
再额外补充一下,meta标签一些其他比较重要的设置。
window-target
表示用于显示窗口的设定
说明:这是一道常见的面试题,如何防止别人通过iframe嵌入自己的网页?
content-Type
用来定义页面使用的语言。
viewport
用来表示移动端友好,让pc端展示的网页,在移动端也能有比较好的展示效果。