常用meta整理

< meta > 元素

概要

meta標(biāo)簽提供關(guān)于HTML文檔的元數(shù)據(jù)。元數(shù)據(jù)不會顯示在頁面上,但是對于機器是可讀的。它可用于瀏覽器(如何顯示內(nèi)容或重新加載頁面),搜索引擎(關(guān)鍵詞),或其他 web 服務(wù)。

  • 頁面關(guān)鍵詞,每個網(wǎng)頁應(yīng)具有描述該網(wǎng)頁內(nèi)容的一組唯一的關(guān)鍵字。

    使用人們可能會搜索,并準(zhǔn)確描述網(wǎng)頁上所提供信息的描述性和代表性關(guān)鍵字及短語。標(biāo)記內(nèi)容太短,則搜索引擎可能不會認為這些內(nèi)容相關(guān)。另外標(biāo)記不應(yīng)超過 874 個字符。
    <pre><meta name="keywords" content="your tags" /></pre>

  • 頁面描述,每個網(wǎng)頁都應(yīng)有一個不超過 150 個字符且能準(zhǔn)確反映網(wǎng)頁內(nèi)容的描述標(biāo)簽。
    <pre><meta name="description" content="150 words" /></pre>

  • 搜索引擎索引方式,robotterms是一組使用逗號(,)分割的值,通常有如下幾種取值:none,noindex,nofollow,all,index和follow。確保正確使用nofollow和noindex屬性值。
    <pre>
    <meta name="robots" content="index,follow" />

</pre>

  • 頁面重定向和刷新:content內(nèi)的數(shù)字代表時間(秒),既多少時間后刷新。如果加url,則會重定向到指定網(wǎng)頁(搜索引擎能夠自動檢測,也很容易被引擎視作誤導(dǎo)而受到懲罰)。
    <pre><meta http-equiv="refresh" content="0;url=" /></pre>

  • 其他
    <pre>
    <meta name="author" content="author name" />
    <meta name="google" content="index,follow" />
    <meta name="googlebot" content="index,follow" />
    <meta name="verify" content="index,follow" />
    </pre>

移動設(shè)備

  • viewport:能優(yōu)化移動瀏覽器的顯示。如果不是響應(yīng)式網(wǎng)站,不要使用initial-scale或者禁用縮放。

    大部分4.7-5寸設(shè)備的viewport寬設(shè)為360px;5.5寸設(shè)備設(shè)為400px;iphone6設(shè)為375px;ipone6 plus設(shè)為414px。
    <pre>
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>

    </pre>

  1. width:寬度(數(shù)值 / device-width)(范圍從200 到10,000,默認為980 像素)
  2. height:高度(數(shù)值 / device-height)(范圍從223 到10,000)
  3. initial-scale:初始的縮放比例 (范圍從>0 到10)
  4. minimum-scale:允許用戶縮放到的最小比例
  5. maximum-scale:允許用戶縮放到的最大比例
  6. user-scalable:用戶是否可以手動縮 (no,yes)7. minimal-ui:可以在頁面加載時最小化上下狀態(tài)欄。(已棄用)

注意,很多人使用initial-scale=1到非響應(yīng)式網(wǎng)站上,這會讓網(wǎng)站以100%寬度渲染,用戶需要手動移動頁面或者縮放。如果和initial-scale=1同時使用user-scalable=no或maximum-scale=1,則用戶將不能放大/縮小網(wǎng)頁來看到全部的內(nèi)容。

  • WebApp全屏模式:偽裝app,離線應(yīng)用。
    <pre>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    </pre>

  • 隱藏狀態(tài)欄/設(shè)置狀態(tài)欄顏色:只有在開啟WebApp全屏模式時才生效。content的值為default | black | black-translucent 。
    <pre><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /></pre>

  • 添加到主屏后的標(biāo)題
    <pre><meta name="apple-mobile-web-app-title" content="標(biāo)題"></pre>

meta123
  • 忽略數(shù)字自動識別為電話號碼
    <pre><meta content="telephone=no" name="format-detection" /></pre>

  • 忽略識別郵箱
    <pre><meta content="email=no" name="format-detection" /></pre>

  • 添加智能 App 廣告條 Smart App Banner:告訴瀏覽器這個網(wǎng)站對應(yīng)的app,并在頁面上顯示下載banner(如下圖)。參考文檔
    <pre>
    <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
    </pre>

](http://www.runoob.com/wp-content/uploads/2015/06/bVkgzR)

  • 其他 參考文檔
    <pre>

    <meta name="HandheldFriendly" content="true">

    <meta name="MobileOptimized" content="320">

    <meta name="screen-orientation" content="portrait">

    <meta name="x5-orientation" content="portrait">

    <meta name="full-screen" content="yes">

    <meta name="x5-fullscreen" content="true">

    <meta name="browsermode" content="application">

    <meta name="x5-page-mode" content="app">

    <meta name="msapplication-tap-highlight" content="no">
    </pre>

網(wǎng)頁相關(guān)

  • 申明編碼
    <pre><meta charset='utf-8' /></pre>

  • 優(yōu)先使用 IE 最新版本和 Chrome
    <pre>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <meta http-equiv="X-UA-Compatible" content="IE=6" >
    <meta http-equiv="X-UA-Compatible" content="IE=7" >
    <meta http-equiv="X-UA-Compatible" content="IE=8" >
    </pre>

  • 瀏覽器內(nèi)核控制:國內(nèi)瀏覽器很多都是雙內(nèi)核(webkit和Trident),webkit內(nèi)核高速瀏覽,IE內(nèi)核兼容網(wǎng)頁和舊版網(wǎng)站。而添加meta標(biāo)簽的網(wǎng)站可以控制瀏覽器選擇何種內(nèi)核渲染。參考文檔
    <pre><meta name="renderer" content="webkit|ie-comp|ie-stand"></pre>

國內(nèi)雙核瀏覽器默認內(nèi)核模式如下:

  1. 搜狗高速瀏覽器、QQ瀏覽器:IE內(nèi)核(兼容模式)

  2. 360極速瀏覽器、遨游瀏覽器:Webkit內(nèi)核(極速模式)

  • 禁止瀏覽器從本地計算機的緩存中訪問頁面內(nèi)容:這樣設(shè)定,訪問者將無法脫機瀏覽。
    <pre><meta http-equiv="Pragma" content="no-cache"></pre>

  • Windows 8
    <pre>
    <meta name="msapplication-TileColor" content="#000"/>
    <meta name="msapplication-TileImage" content="icon.png"/>
    </pre>

  • 站點適配:主要用于PC-手機頁的對應(yīng)關(guān)系。
    <pre>
    <meta name="mobile-agent"content="format=[wml|xhtml|html5]; url=url">

</pre>

  • 轉(zhuǎn)碼申明:用百度打開網(wǎng)頁可能會對其進行轉(zhuǎn)碼(比如貼廣告),避免轉(zhuǎn)碼可添加如下meta。
    <pre><meta http-equiv="Cache-Control" content="no-siteapp" /></pre>

其他參考文檔

COMPLETE LIST OF HTML META TAGS

W3C META TAGS

METATAGES in HTML5

MDN META TAGS

來源:http://segmentfault.com/a/1190000002407912
</div>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • < meta > 元素 1、概要 標(biāo)簽提供關(guān)于HTML文檔的元數(shù)據(jù)。元數(shù)據(jù)不會顯示在頁面上,但是對于機器是可讀的。...
    小豌豆書吧閱讀 482評論 0 0
  • 標(biāo)簽提供關(guān)于HTML文檔的元數(shù)據(jù)。元數(shù)據(jù)不會顯示在頁面上,但是對于機器是可讀的。它可用于瀏覽器(如何顯示內(nèi)容或重新...
    7ece657ee3b6閱讀 471評論 3 2
  • 一、概述 HTML 元素表示那些不能由其它HTML元相關(guān)元素 ( , , , 或 ) 之一表示的任何...
    青鳴閱讀 797評論 0 0
  • 隨著html5的普及和Web技術(shù)的凈化,從Windows XP的IE6到IE8、IE9、IE10、IE11,Edg...
    波段頂?shù)?/span>閱讀 2,419評論 1 1
  • 我曾經(jīng)總是嘗試和糾正家人一些我覺得不太好的觀點,但結(jié)果總是適得其反。我一度懷疑是我錯了嗎? 因為小姑子嫁了一個婆...
    我是珊珊呀閱讀 253評論 0 0

友情鏈接更多精彩內(nèi)容