Meta http-equiv 属性解析

Meta标签的http-equiv的语法格式:
参数:
1.expires(期限)
用于设置网页的到期时间,一旦网页到期,必须到服务器上重新传输。
eg:

<meta http-equiv="expires" content="Wed,20 Jun 2020 16:23:00 GMT">

注:必须是GMT标准时间

2.pragma
用于设置浏览器不缓存页面。
eg:

<meta http-equiv="pragma" content="no-cache">
//另外2种设置不缓存的写法
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

3.refresh(刷新)
倒计时(单位秒)自动刷新并可指向新页面,也可以不指定新页面
eg:

//2秒后跳转到百度
<meta http-equiv="refresh" content="2; url=http://www.baidu.com/">
//2秒后刷新本页面
<meta http-equiv="refresh" content="2">

4.Set-Cookie(设置cookie)
如果网页过期,那么存盘的cookie将被删除。
eg:

<meta http-equiv="Set-Cookie" content="cookievalue=xxx; expires=Friday, 12 Jan 2020 22:41:28 GMT">
//cookievalue为设置的cookie的值

5.content-type
设置页面使用的编码格式(字符集)
eg:

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

还有很多http-equiv属性的参数值,后续有时间再补充。

发布了13 篇原创文章 · 获赞 0 · 访问量 529

猜你喜欢

转载自blog.csdn.net/babdpfi/article/details/104843577
今日推荐