meta標籤大全(薦)

html的meta總結(經常使用)

一、Meta標籤大全javascript

<!-- 聲明文檔使用的字符編碼 --> <meta charset='utf-8'> <!-- 優先使用 IE 最新版本和 Chrome --> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> <!-- 頁面描述 --> <meta name="description" content="不超過150個字符"/> <!-- 頁面關鍵詞 --> <meta name="keywords" content=""/> <!-- 網頁做者 --> <meta name="author" content="name, email@gmail.com"/> <!-- 搜索引擎抓取 --> <meta name="robots" content="index,follow"/> <!-- 爲移動設備添加 viewport --> <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no"> <!-- `width=device-width` 會致使 iPhone 5 添加到主屏後以 WebApp 全屏模式打開頁面時出現黑邊 http://bigc.at/ios-webapp-viewport-meta.orz --> <!-- iOS 設備 begin --> <!-- 添加到主屏後的標題(iOS 6 新增) --> <meta name="apple-mobile-web-app-title" content="標題"> <!-- 是否啓用 WebApp 全屏模式,刪除蘋果默認的工具欄和菜單欄 --> <meta name="apple-mobile-web-app-capable" content="yes"/> <!-- 添加智能 App 廣告條 Smart App Banner(iOS 6+ Safari) --> <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"> <!-- 設置蘋果工具欄顏色 --> <meta name="apple-mobile-web-app-status-bar-style" content="black"/> <!-- 忽略頁面中的數字識別爲電話,忽略email識別 --> <meta name="format-detection" content="telphone=no, email=no"/> <!-- 啓用360瀏覽器的極速模式(webkit) --> <meta name="renderer" content="webkit"> <!-- 避免IE使用兼容模式 --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 不讓百度轉碼 --> <meta http-equiv="Cache-Control" content="no-siteapp" /> <!-- 針對手持設備優化,主要是針對一些老的不識別viewport的瀏覽器,好比黑莓 --> <meta name="HandheldFriendly" content="true"> <!-- 微軟的老式瀏覽器 --> <meta name="MobileOptimized" content="320"> <!-- 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"> <!-- windows phone 點擊無高光 --> <meta name="msapplication-tap-highlight" content="no"> <!-- iOS 圖標 begin --> <!-- iPhone 和 iTouch,默認 57x57 像素,必須有 --> <link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-57x57-precomposed.png"/> <!-- Retina iPhone 和 Retina iTouch,114x114 像素,能夠沒有,但推薦有 --> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png"/> <!-- Retina iPad,144x144 像素,能夠沒有,但推薦有 --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144x144-precomposed.png"/> <!-- iOS 圖標 end --> <!-- iOS 啓動畫面 begin --> <link rel="apple-touch-startup-image" sizes="768x1004" href="/splash-screen-768x1004.png"/> <!-- iPad 豎屏 768 x 1004(標準分辨率) --> <link rel="apple-touch-startup-image" sizes="1536x2008" href="/splash-screen-1536x2008.png"/> <!-- iPad 豎屏 1536x2008(Retina) --> <link rel="apple-touch-startup-image" sizes="1024x748" href="/Default-Portrait-1024x748.png"/> <!-- iPad 橫屏 1024x748(標準分辨率) --> <link rel="apple-touch-startup-image" sizes="2048x1496" href="/splash-screen-2048x1496.png"/> <!-- iPad 橫屏 2048x1496(Retina) --> <link rel="apple-touch-startup-image" href="/splash-screen-320x480.png"/> <!-- iPhone/iPod Touch 豎屏 320x480 (標準分辨率) --> <link rel="apple-touch-startup-image" sizes="640x960" href="/splash-screen-640x960.png"/> <!-- iPhone/iPod Touch 豎屏 640x960 (Retina) --> <link rel="apple-touch-startup-image" sizes="640x1136" href="/splash-screen-640x1136.png"/> <!-- iPhone 5/iPod Touch 5 豎屏 640x1136 (Retina) --> <!-- iOS 啓動畫面 end --> <!-- iOS 設備 end --> <!-- Windows 8 磁貼顏色 --> <meta name="msapplication-TileColor" content="#000"/> <!-- Windows 8 磁貼圖標 --> <meta name="msapplication-TileImage" content="icon.png"/> <!-- 添加 RSS 訂閱 --> <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml"/> <!-- 添加 favicon icon --> <link rel="shortcut icon" type="image/ico" href="/favicon.ico"/> <!-- 關閉chrome瀏覽器下 翻譯 插件 --> <meta name="google" value="notranslate" /> <!-- sns 社交標籤 begin --> <!-- 參考微博API --> <meta property="og:type" content="類型" /> <meta property="og:url" content="URL地址" /> <meta property="og:title" content="標題" /> <meta property="og:image" content="圖片" /> <meta property="og:description" content="描述" /> <!-- sns 社交標籤 end -->

 

二、IOS中Safari容許全屏瀏覽:html

<meta content="yes" name="apple-mobile-web-app-capable">

三、IOS中Safari頂端狀態條樣式:java

<meta content="black" name="apple-mobile-web-app-status-bar-style">

四、忽略將數字變爲電話號碼:ios

<meta content="telephone=no" name="format-detection"> //通常狀況下,IOS和Android系統都會默認某長度內的數字爲電話號碼,即便不加也是會默認顯示爲電話的,so,取消這個頗有必要!

五、IOS中Safari設置保存到桌面圖標: 
這是IOS中Safari特有的meta,是在你保存某個頁面到桌面的時候使用這張圖做爲桌面圖標,so,尺寸和iphone上的一致,是57*57pxweb

<link rel="apple-touch-icon" href="custom_icon.png">

六、這段代碼指定了HTML頁面使用的字符編碼爲gb2312,即國標漢字碼,不一樣的語言對應不一樣的charset,日文對應的字符集是:」iso-2022-jp」, 韓文對應的字符集: 「ks_c_5601」。chrome

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

   
七、這段代碼讓網頁在指定的5秒內,跳轉到所指定的頁面,好比博客園首頁,或者網頁的自動刷新。windows

  <meta http-equiv="Refresh" content="5; url=http://www.cnblogs.com" />

八、這段代碼能夠用於設定網頁的到期時間,一旦過時必須到服務器上從新調用(GMT時間格式)。瀏覽器

<meta http-equiv="Expires" content="Mon,1,May 2015 00:00:00 GMT" />

 

九、這段代碼用於設定禁止瀏覽器從本地機的緩存中調閱頁面內容,設定後一旦離開網頁就沒法從Cache中再調出。緩存

   <meta http-equiv="Pragma" content="no-cache" />

十、這段代碼用於網頁等級的評定,在IE的internet選項中有一項內容設置能夠防止瀏覽一些受限制的網站,而網站的限制等級就是經過meta屬性的設置。服務器

   <meta http-equiv="Pics-label" content="" />

十一、這段代碼能夠強制頁面在當前窗口中以獨立頁面顯示,防止本身的網頁被別人當成一個frame調用。Content選項:_blank、_top、_self、_parent

   <meta http-equiv="windows-Target" content="_top" />

十二、Page-Enter、Page-Exit是頁面被載入和調出時的一些特效。相應的還有:Site-Exit和Site-Enter離開和進入網站。content表示的是網頁過渡的效果設置,本例中的RevealTrans是動態濾鏡的一種,能夠用於進入和退出的效果,Duration表示濾鏡特效的持續時間(單位:s), Transition:表示濾鏡的類型,取值爲0到23。

<Meta http-equiv="Page-Enter" Content="revealTrans(Duration=0.5,tansition=10" /> <Meta http-equiv="Page-Exit" Content="revealTrans(Duration=0.5,transition=12" />

  注意:這些特效我本身作了一些測試,在Chrome, FF,下特效都顯示不出來,原文(HTML頁面過渡效果大全)中測試環境是IE5.5之上,不過我利用IE tester只在IE8中測試出效果了。 


html標籤中meta屬性使用介紹

  meta是html語言head區的一個輔助性標籤。也許你認爲這些代碼無關緊要。 
   
  其實若是你可以用好meta標籤,會給你帶來意想不到的效果。

  meta標籤的做用有:搜索引擎優化(SEO),定義頁面使用語言,自動刷新並指向新的頁面,實現網頁轉換時的動態效果,控制頁面緩衝,網頁定級評價,控制網頁顯示的窗口等! 
   
  meta標籤的組成:meta標籤共有兩個屬性,它們分別是http-equiv屬性和name屬性,不一樣的屬性又有不一樣的參數值,這些不一樣的參數值就實現了不一樣的網頁功能。 

1、name屬性

  name屬性主要用於描述網頁,與之對應的屬性值爲content,content中的內容主要是便於搜索引擎機器人查找信息和分類信息用的。

meta標籤的name屬性語法格式是:

<meta name="參數"content="具體的參數值">。

其中name屬性主要有如下幾種參數:  


A、Keywords(關鍵字) 

說明:keywords用來告訴搜索引擎你網頁的關鍵字是什麼。

舉例:

<meta name="keywords"content="meta總結,html meta,meta屬性,meta跳轉"> 

B、description(網站內容描述)

說明:description用來告訴搜索引擎你的網站主要內容。

舉例:

<meta name="description"content="haorooms博客,html的meta總結,meta是html語言head區的一個輔助性標籤。"> 

C、robots(機器人嚮導)

說明:robots用來告訴搜索機器人哪些頁面須要索引,哪些頁面不須要索引。

content的參數有all,none,index,noindex,follow,nofollow。默認是all。

舉例:

<meta name="robots"content="none"> 

具體參數以下:

  信息參數爲all:文件將被檢索,且頁面上的連接能夠被查詢;

  信息參數爲none:文件將不被檢索,且頁面上的連接不能夠被查詢;

  信息參數爲index:文件將被檢索;

  信息參數爲follow:頁面上的連接能夠被查詢;

  信息參數爲noindex:文件將不被檢索,但頁面上的連接能夠被查詢;

  信息參數爲nofollow:文件將被檢索,但頁面上的連接不能夠被查詢;



D、author(做者)

說明:標註網頁的做者

舉例:

<meta name="author"content="root,root@xxxx.com"> 


E、generator

<meta name="generator"content="信息參數"/> 

meta標籤的generator的信息參數,表明說明網站的採用的什麼軟件製做。 


F、COPYRIGHT

<META NAME="COPYRIGHT"CONTENT="信息參數"> 

meta標籤的COPYRIGHT的信息參數,表明說明網站版權信息。



G、revisit-after

<META name="revisit-after"CONTENT="7days"> 

revisit-after表明網站重訪,7days表明7天,依此類推。

 

2、http-equiv屬性

  http-equiv顧名思義,至關於http的文件頭做用,它能夠向瀏覽器傳回一些有用的信息,以幫助正確和精確地顯示網頁內容,與之對應的屬性值爲content,content中的內容其實就是各個參數的變量值。

meta標籤的http-equiv屬性語法格式是:

<meta http-equiv="參數"content="參數變量值">; 

其中http-equiv屬性主要有如下幾種參數:



A、Expires(期限)

說明:能夠用於設定網頁的到期時間。一旦網頁過時,必須到服務器上從新傳輸。

用法:

<meta http-equiv="expires"content="Fri,12Jan200118:18:18GMT"> 

注意:必須使用GMT的時間格式。



B、Pragma(cache模式)

說明:禁止瀏覽器從本地計算機的緩存中訪問頁面內容。

用法:

<meta http-equiv="Pragma"content="no-cache"> 

注意:這樣設定,訪問者將沒法脫機瀏覽。 


C、Refresh(刷新)

說明:自動刷新並指向新頁面。

用法:

//(注意後面的引號,分別在秒數的前面和網址的後面) <meta http-equiv="Refresh"content="2;URL=http://www.haorooms.com"> 

注意:其中的2是指停留2秒鐘後自動刷新到URL網址。



D、Set-Cookie(cookie設定)

說明:若是網頁過時,那麼存盤的cookie將被刪除。

用法:

<meta http-equiv="Set-Cookie"content="cookie value=xxx;expires=Friday,12-Jan-200118:18:18GMT;path=/"> 

注意:必須使用GMT的時間格式。



E、Window-target(顯示窗口的設定)

說明:強制頁面在當前窗口以獨立頁面顯示。

用法:

<meta http-equiv="Window-target"content="_top"> 

注意:用來防止別人在框架裏調用本身的頁面。



F、content-Type(顯示字符集的設定)

說明:設定頁面使用的字符集。

用法:

<meta http-equiv="content-Type"content="text/html;charset=gb2312"> 

具體以下:

  meta標籤的charset的信息參數如GB2312時,表明說明網站是採用的編碼是簡體中文;

  meta標籤的charset的信息參數如BIG5時,表明說明網站是採用的編碼是繁體中文;

  meta標籤的charset的信息參數如iso-2022-jp時,表明說明網站是採用的編碼是日文;

  meta標籤的charset的信息參數如ks_c_5601時,表明說明網站是採用的編碼是韓文;

  meta標籤的charset的信息參數如ISO-8859-1時,表明說明網站是採用的編碼是英文;

  meta標籤的charset的信息參數如UTF-8時,表明世界通用的語言編碼;



G、content-Language(顯示語言的設定)

用法:

<meta http-equiv="Content-Language"content="zh-cn"/> 

H、Cache-Control指定請求和響應遵循的緩存機制。

Cache-Control指定請求和響應遵循的緩存機制。在請求消息或響應消息中設置Cache-Control並不會修改另外一個消息處理過程當中的緩存處理過程。請求時的緩存指令包括no-cache、no-store、max-age、max-stale、min-fresh、only-if-cached,響應消息中的指令包括public、private、no-cache、no-store、no-transform、must-revalidate、proxy-revalidate、max-age。各個消息中的指令含義以下

Public指示響應可被任何緩存區緩存

Private指示對於單個用戶的整個或部分響應消息,不能被共享緩存處理。這容許服務器僅僅描述當用戶的部分響應消息,此響應消息對於其餘用戶的請求無效

  no-cache指示請求或響應消息不能緩存

  no-store用於防止重要的信息被無心的發佈。在請求消息中發送將使得請求和響應消息都不使用緩存。

  max-age指示客戶機能夠接收生存期不大於指定時間(以秒爲單位)的響應

  min-fresh指示客戶機能夠接收響應時間小於當前時間加上指定時間的響應

  max-stale指示客戶機能夠接收超出超時期間的響應消息。若是指定max-stale消息的值,那麼客戶機能夠接收超出超時期指定值以內的響應消息。



J、http-equiv=」imagetoolbar」

<meta http-equiv="imagetoolbar"content="false"/> 

指定是否顯示圖片工具欄,當爲false表明不顯示,當爲true表明顯示。



K、Content-Script-Type

<Meta http-equiv="Content-Script-Type"Content="text/javascript"> 

W3C網頁規範,指明頁面中腳本的類型。



L 、頁面跳轉,只用於IE

具體請看 http://www.haorooms.com/post/liulanq_think_ie

相關文章
相關標籤/搜索