ios提供了PWA支持,通过manifest.json来配置具体属性,包含应用名称,应用图标等。具体示例如下:
1. 在h5 首页中加入 manifest
<!DOCTYPE html>
<html lang="en" class="no-js no-webp">
<head>
<title>roots</title>
<link rel="manifest" href="/site.webmanifest">
2. 首页同级目录中添加 site.webmanifest文件,文件内容如下:
{
"background_color": "#ffffff",
"description": "ddd.",
"display": "standalone",
"icons": [
{
"src": "icon/icon192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "icon/icon196.png",
"sizes": "196x196",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "icon/icon256.png",
"sizes": "256x256",
"type": "image/png",
"purpose": "any"
},
{
"src": "icon/icon512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
}
],
"name": "ddd",
"prefer_related_applications": false,
"scope": "/",
"short_name": "name",
"start_url": "/?source=pwa",
"theme_color": "#ffffff"
}