在開發(fā)網(wǎng)站時中我們通常會設置一個 Touch Icon。由于系統(tǒng)的差異性,添加到桌面圖標并沒有統(tǒng)一的標準。iOS 最早支持 Touch Icon,并有明確的規(guī)范,其他系統(tǒng)一定程度上支持 iOS 的規(guī)范。
下面是兼容 iOS 4.2+ 及 Android 2.1+ 的通用寫法:
<link rel="apple-touch-icon-precomposed" href="/path/to/icon72x72@2x.png">
<!-- Add to homescreen for Safari on iOS -->
<!-- 添加至主屏, 從主屏進入會隱藏地址欄和狀態(tài)欄, 全屏(content="yes") -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- 系統(tǒng)頂欄的顏色(content = black、white 和 black-translucent)選其一就可以 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- 指定標題 -->
<meta name="apple-mobile-web-app-title" content="Web Starter Kit">
<!-- 指定icon, 建議PNG格式-->
<link rel="apple-touch-icon" href="touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad-retina.png">
<!--
使用rel="apple-touch-icon"屬性為“增加高光光亮的圖標”, 系統(tǒng)會自動為圖標添加圓角及高光;
使用rel="apple-touch-icon-precomposed"屬性為“設計原圖圖標”;
-->
尺寸說明:機型 | iPhone 5 and iPod touch (高分辨率) | iPhone and iPod touch (高分辨率) | iPad and iPad mini (高分辨率) | iPad 2 and iPad mini (標準分辨率) |
---|---|---|---|---|
尺寸 (px) | 120 x 120 | 120 x 120 | 152 x 152 | 76 x 76 |
<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="196x196" href="images/touch/chrome-touch-icon-196x196.png">
參考鏈接:<!-- Tile icon for Win8 (144x144 + tile color) -->
<!-- win 8 磁貼圖標 -->
<meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
<!-- win 8 磁貼顏色 -->
<meta name="msapplication-TileColor" content="#3372DF">
參考鏈接:
更多建議: