苹果端保存到桌面代码:(注意尺寸是57x57)
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta content="telephone=yes" name="format-detection"/>
<meta name="apple-mobile-web-app-status-bar-style" content="white"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="apple-touch-fullscreen" content="yes"/>
<link href="css/pc/index.css" type="text/css" rel="stylesheet"/>
<link rel="apple-touch-icon" sizes="57x57" href="img/logo-k.png"/>
<link href="img/page-icon.png" rel="shortcut icon"/>
试了一下发现安卓端用浏览器打开保存到桌面后图标显示不了,(chrome和UC)都不行。但是看了哔哩哔哩网站上的可以。
安卓端于是多了一行代码:
<link rel="manifest" href="manifest.json">
manifest.json文件内容如下(直接复制哔哩哔哩的):
{
"name": "哔哩哔哩web版",
"short_name" :"bilibili",
"start_url": "index.html",
"display": "standalone",
"orientation": "portrait",
"theme_color": "#de698c",
"background_color": "#fff",
"icons": [{
"src": "//s1.hdslb.com/bfs/static/mult/images/app_logo.png@36w_36h.png",
"sizes": "36x36",
"type": "image/png"
}, {
"src": "//s1.hdslb.com/bfs/static/mult/images/app_logo.png@48w_48h.png",
"sizes": "48x48",
"type": "image/png"
}, {
"src": "//s1.hdslb.com/bfs/static/mult/images/app_logo.png@72w_72h.png",
"sizes": "72x72",
"type": "image/png"
}, {
"src": "//s1.hdslb.com/bfs/static/mult/images/app_logo.png@96w_96h.png",
"sizes": "96x96",
"type": "image/png"
}, {
"src": "//static.hdslb.com/mobile/img/512.png",
"sizes": "144x144",
"type": "image/png"
}, {
"src": "//static.hdslb.com/mobile/img/512.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "//static.hdslb.com/mobile/img/512.png",
"sizes": "256x256",
"type": "image/png"
}, {
"src": "//static.hdslb.com/mobile/img/512.png",
"sizes": "512x512",
"type": "image/png"
}],
"permissions": {
"desktop-notification": {
"description": "Needed for creating system notifications."
}
}
}
看了一下他们需要适应不同的手机屏幕,所以就有不同的尺寸。
查看看下Mozilla 的web开发文档Manifest文件的解释如下:
https://developer.mozilla.org/zh-CN/Apps/Build/Manifest
于是安卓端也可以保存到桌面webApp了(chrome和UC可以,其他的没去一一试。)
刚离职,心有点乱,一直在努力着,希望可以尽快找到合适自己的工作。