美文网首页
html meta相关属性介绍

html meta相关属性介绍

作者: 一懒众衫小小小小 | 来源:发表于2020-04-15 10:57 被阅读0次

    html meta相关属性介绍

    1. name、content组合

    • H5设定网页字符集
    <meta charset="UTF-8">
    
    • 网站外部图片链接加载不出来问题
    <meta name="referrer" content="no-referrer"/>
    
    • 禁止浏览器从本地计算机的缓存中访问页面内容
    <meta http-equiv="pragma" content="no-store">
    
    • 先发送请求,与服务器确认该资源是否被更改,未被更改则使用缓存。no-siteapp避免百度打开网页时可能会对其进行转码(比如贴广告等)
    <meta http-equiv="Cache-Control" content="no-cache,no-store">//
    
    • 指定网页的过期时间,过期后必须重新请求服务器。
    <meta http-equiv="expires" content="0">
    
    • 忽略数字自动识别为电话号码,忽略识别邮箱
    <meta name="format-detection" content="telephone=no,email=no"/>
    
    • 是否可放缩
    <meta name="wap-font-scale" content="no">
    
    • shrink-to-fit=no是为了兼容iOS9
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,shrink-to-fit=no">
    

    2. http-equiv属性

    • 用于告知浏览器以何种版本渲染当前页面。
    //优先使用IE最新版本和Chrome
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    
    • 旧的HTML,不推荐。
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
    
    • 定时刷新
    //30s后刷新自己
    <meta http-equiv="refresh" content="30" > 
    
    • 定时跳转
    //30s后跳转到百度
    <meta http-equiv="refresh" content="30;URL="http://www.baidu.com" > 
    
    • 指定网页的过期时间,过期后必须重新请求服务器。
    <meta http-equiv="expires" content="Sat, 29 Apr 2019 04:25:02 GMT" >
    
    • 双核浏览器的渲染方式,用于指定双核浏览器默认以何种方式渲染页面。
    //默认webkit内核/默认IE兼容模式/默认IE标准模式
    <meta name="renderer" content="webkit/ie-comp/ie-stand" />
    
    • Referrer Policy规定了五种Referrer策略。referrer策略和网页安全有关,在分析用户来源时非常有用
    <meta name="referrer" content="no-referrer|origin|no-referrer-when-downgrade|origin-when-crossorigin|unsafe-url" />
    

    相关文章

      网友评论

          本文标题:html meta相关属性介绍

          本文链接:https://www.haomeiwen.com/subject/kcwqvhtx.html