meta元素共有三個可選屬性(http-equiv、name和scheme)和一個必選屬性(content),content定義與 http-equiv 或 name 屬性相關的元信息javascript
可選屬性html
屬性 | 值 | 描述 |
---|---|---|
http-equiv | content-type / expire / refresh / set-cookie | 把content屬性關聯到HTTP頭部 |
name | author / description / keywords / generator / revised / others | 把 content 屬性關聯到一個名稱 |
scheme | some_text | 定義用於翻譯 content 屬性值的格式 |
必選屬性java
屬性 | 值 | 描述 |
---|---|---|
content | some_text | 定義與 http-equiv 或 name 屬性相關的元信息 |
name屬性web
<!-- 頁面做者 --> <meta name="author" content="author name" /> <!-- 頁面描述 --> <meta name="description" content="meta元素共有三個可選屬性(不超過150字符)" /> <!-- 頁面關鍵詞 --> <meta name="keywords" content="meta標籤總結,meta標籤" /> <!-- 頁面生成器 --> <meta name="generator" content="hexo" /> <!-- 頁面修改信息 --> <meta name="revised" content="story,2015/07/22" /> <!-- 版權信息 --> <meta name="copyright" content="All Rights Reserved" /> <!-- 頁面爬蟲設置 --> <meta name="robots" content="index,follow" /> <!-- robots的content取值 --> <!-- all:文件將被檢索,且頁面上的連接能夠被查詢 --> <!-- none:文件將不被檢索,且頁面上的連接不能夠被查詢 --> <!-- index:文件將被檢索 --> <!-- follow:頁面上的連接能夠被查詢 --> <!-- noindex:文件將不被檢索,但頁面上的連接能夠被查詢 --> <!-- nofollow:文件將被檢索,但頁面上的連接不能夠被查詢 -->
http-equiv緩存
<!-- 字符編碼 --> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <!-- 頁面到期時間 --> <meta http-equiv="expire" content="Wed,22Jul201511:11:11GMT" /> <!-- 頁面重刷新,0秒後刷新並跳轉 --> <meta http-equiv="refresh" content="0;URL=''" /> <!-- cookie設置 --> <meta http-equiv="set-cookie" content="cookie value=xxx;expires=Wed,22-Jul-201511:11:11GMT;path=/" /> <!-- 腳本類型 --> <meta http-equiv="Content-Script-Type"Content="text/javascript"> <!-- 禁止從本地緩存中讀取頁面 --> <meta http-equiv="Pragma"content="no-cache">
移動端cookie
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/> <!-- viewport的content取值 --> <!-- width:寬度(數值 / device-width)(200~10000,默認爲980px) --> <!-- height:高度(數值 / device-height)(223~10000) --> <!-- initial-scale:初始縮放比例 (0~10) --> <!-- minimum-scale:容許用戶縮放到的最小比例 --> <!-- maximum-scale:容許用戶縮放到的最大比例 --> <!-- user-scalable:是否容許用戶縮放 (no/yes) --> <!-- uc強制豎屏 --> <meta name="screen-orientation" content="portrait"> <!-- QQ強制豎屏 --> <meta name="x5-orientation" content="portrait"> <!-- UC強制全屏 --> <meta name="full-screen" content="yes"> <!-- QQ強制全屏 --> <meta name="x5-fullscreen" content="true"> <!-- UC應用模式 --> <meta name="browsermode" content="application"> <!-- QQ應用模式 --> <meta name="x5-page-mode" content="app"> <!-- IOS啓用 WebApp 全屏模式 --> <meta name="apple-mobile-web-app-capable" content="yes" /> <!-- IOS全屏模式下隱藏狀態欄/設置狀態欄顏色 content的值爲default | black | black-translucent --> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <!-- IOS添加到主屏後的標題 --> <meta name="apple-mobile-web-app-title" content="標題"> <!-- IOS添加智能 App 廣告條 Smart App Banner --> <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"> <!-- 去除iphone 識別數字爲號碼 --> <meta name="format-detection" content="telephone=no"> <!-- 不識別郵箱 --> <meta name="format-detection" content="email=no"> <!-- 禁止跳轉至地圖 --> <meta name="format-detection" content="adress=no"> <!-- 能夠連寫--> <meta name="format-detection" content="telephone=no,email=no,adress=no">