移動終端h5頁面常用的meta屬性

width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0

語法:

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">

強制讓文檔的寬度與設備的寬度保持1:1,並且文檔最大的寬度比例是1.0,且不允許用戶點擊屏幕放大瀏覽;
width - viewport的寬度 height - viewport的高度
initial-scale - 初始的縮放比例
minimum-scale - 允許用戶縮放到的最小比例
maximum-scale - 允許用戶縮放到的最大比例
user-scalable - 用戶是否可以手動縮放

apple-mobile-web-app-capable

語法:

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

apple-mobile-web-app-capable是設置web應用是否以全屏模式運行
說明:如果content設置爲yes,web應用會以全屏模式運行。content設置爲no,表示正常顯示。可以通過只讀屬性window.navigator.standalone來確定網頁是否以全屏顯示。

apple-mobile-web-app-status-bar-style

語法:

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

iphone的私有標籤,它指定在iphone中safari頂端的狀態條的樣式;在web app應用下狀態條(屏幕頂部條)的顏色;
默認值爲default(白色),可以定爲black(黑色)和black-translucent(灰色半透明)。
注意:若值爲“black-translucent”將會佔據頁面px位置,浮在頁面上方(會覆蓋頁面20px高度–iphone4和itouch4的Retina屏幕爲40px)

telephone=no

語法:

<meta name="format-detection" content="telephone=no" >

告訴設備忽略將頁面中的數字識別爲電話號碼。

email=no

<meta name="format-detection" content="email=no" />

不識別郵箱

name=“Keywords”(關鍵字)

語法:

<meta name="Keywords" content="手機購物,WAP商城,日用百貨,3C家電,汽車用品">

向搜索引擎說明你的網頁的關鍵詞

name=“description”(網頁描述)

語法:

<meta name="description" content="京東手機版提供了包括數碼、家電、手機、電腦配件、網絡產品、日用百貨等數萬種商品,手機快捷購物,就上京東手機版。">

告訴搜索引擎你的站點的主要內容

name=“Author”(作者)

語法:

<meta name="Author" contect="你的姓名">

告訴搜索引擎你的站點的製作的作者

name="Copyright "(版權)

語法:

<Meta name="Copyright" Content="本頁版權歸Zerospace所有。All Rights Reserved">

標註版權

name=“Generator”(編輯器)

語法:

<Meta name="Generator" Content="PCDATA|FrontPage|">

注意:Content=“你所用編輯器”

name=“revisit-after”(重訪)

語法:

<meta name="revisit-after" Content="7 days" >

通知搜索引擎多少天訪問一次

name=“Robots”(機器人嚮導)

語法:

<meta name="Robots" contect="all | none | index | noindex | follow | nofollow">

其中的屬性說明如下:
all:文件將被檢索,且頁面上的鏈接可以被查詢;
none:文件將不被檢索,且頁面上的鏈接不可以被查詢;
index:文件將被檢索;
follow:頁面上的鏈接可以被查詢;
noindex:文件將不被檢索,但頁面上的鏈接可以被查詢;
nofollow:文件將不被檢索,頁面上的鏈接可以被查詢

apple-touch-icon和apple-touch-icon-precomposed

語法:

<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界面創建應用程序樣式的圖標。

http-equiv=“Cache-Control”

語法:

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

手機頁面通常在第一次加載後會進行緩存,然後每次刷新會使用緩存而不是去重新向服務器發送請求。如果不希望使用緩存可以設置no-cache。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章