webAPP meta 標籤大全

來源:互聯網
上載者:User

標籤:

1.先說說mate標籤裡的viewport:

viewport即可視地區,對於案頭瀏覽器而言,viewport指的就是除去所有工具列、狀態列、捲軸等等之後用於看網頁的地區。對於傳統WEB頁面來說,980的寬度在iphone上顯示是很正常的,也是滿屏的,但對於webapp而言,可能就有點問題了,在iphone上我們的webapp在豎屏下通常寬度都是320。

因此我們必須改變viewport,我們就有如下幾種屬性值可以設定:

width: viewport 的寬度 (範圍從 200 到 10,000 ,預設為 980 像素 )

height: viewport 的高度 (範圍從 223 到 10,000 )

initial-scale: 初始的縮放比例 (範圍從>0到 10 )

minimum-scale: 允許使用者縮放到的最小比例

maximum-scale: 允許使用者縮放到的最大比例

user-scalable: 使用者是否可以手動縮放

對於這些屬性,我們可以設定其中的一個或者多個,並不需要你同時都設定,iPhone 會根據你設定的屬性自動推算其他屬性值 ,而非直接採用預設值。

如果你把initial-scale=1 ,那麼 width 和 height在豎屏時自動為320*356 (不是320*480 因為地址欄等都佔據空間 ),橫屏時自動為 480*208。類似地 ,如果你僅僅設定了 width ,就會自動推算出initial-scale 以及height。例如你設定了 width=320 ,豎屏時 initial-scale 就是 1 ,橫屏時則變成 1.5 了

那麼到底這些設定如何讓 Safari 知道 ?其實很簡單 ,就一個 meta ,形如 :

<meta name=”viewport” content=”width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;” /> 設定了meat後我們頁面將如此呈現了

2.meta標籤裡的name屬性

   name 屬性
(1)、<meta name="Generator" contect="">用以說明產生工具(如Microsoft FrontPage 4.0)等;

(2)、<meta name="keywords" contect="">向搜尋引擎說明你的網頁的關鍵詞;

(3)、<meta name="Description" contect="">告訴搜尋引擎你的網站的主要內容;

(4)、<meta name="Author" contect="你的姓名">告訴搜尋引擎你的網站的製作的作者;

(5)、<meta name="Robots" contect="all | none | index | noindex | follow | nofollow">

其中的屬性說明如下:

設定為all:檔案將被檢索,且頁面上的連結可以被查詢;

設定為none:檔案將不被檢索,且頁面上的連結不可以被查詢;

設定為index:檔案將被檢索;

設定為follow:頁面上的連結可以被查詢;

設定為noindex:檔案將不被檢索,但頁面上的連結可以被查詢;

設定為nofollow:檔案將不被檢索,頁面上的連結可以被查詢

3.webapp裡主要的mate用途

<meta name="apple-touch-fullscreen" content="yes">  添加到主螢幕後,全螢幕顯示。

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

這meta的作用就是刪除預設的蘋果工具列和功能表列。content有兩個值”yes”和”no”,當我們需要顯示工具列和功能表列時,這個行meta就不用加了,預設就是顯示。

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

預設值為default(白色),可以定為black(黑色)和black-translucent(灰色半透明)。
注意: 若值為“black-translucent”將會佔據頁面px位置,浮在頁面上方(會覆蓋頁面20px高度–iphone4和itouch4的Retina螢幕為40px)。

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

在iOS中有兩個meta值,apple-mobile-web-app-capable和apple-mobile-web-app-status-bar-style,這兩個會讓網頁內容以應用程式風格顯示,並使狀態列透明。

<link rel="apple-touch-icon-precomposed" href="http://spion.blog.163.com/blog/iphone_milanoo.png" />
說明: 這個link就是設定web app的放置主螢幕上icon檔案路徑。
圖片尺寸可以設定為57*57(px)或者Retina可以定為114*114(px),ipad尺寸為72*72(px)

<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" /> //將不識別郵箱
告訴裝置忽略將頁面中的數字識別為電話號碼


<link rel="apple-touch-icon" href="/static/images/identity/HTML5_Badge_64.png" />
<link rel="apple-touch-icon-precomposed" href="/static/images/identity/HTML5_Badge_64.png" />

iOS用rel="apple-touch-icon",android 用rel="apple-touch-icon-precomposed"。這樣就能在使用者把網頁存為書籤時,在手機HOME介面建立應用程式樣式的表徵圖。

<meta name="sharecontent" data-msg-img="縮圖地址" data-msg-title="標題" data-msg-content="簡介" data-msg-callBack="" data-line-img="縮圖地址" data-line-title="標題" data-line-callBack=""/>

 

-- 摘自網路

webAPP meta 標籤大全

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.