浏览器如何从pwa的manifest.json中包含的图标数组中选择要选择的图标大小?

时间:2018-12-06 19:24:59

标签: json progressive-web-apps manifest.json

我们都知道manifest.json文件是Web应用程序的元数据,它可以告诉应用程序并可以安装在客户端的移动设备上。 您可以将webapp添加到主屏幕上,并且可以通过单击图标直接访问,但是浏览器是如何知道要为哪个电话使用哪种尺寸的,因为每个电话都有不同的dpi屏幕。

这是一个示例清单文件,具有一堆图标大小

{
  "name": "HackerWeb",
  "short_name": "HackerWeb",
  "start_url": ".",
  "display": "standalone",
  "background_color": "#fff",
  "description": "A simply readable Hacker News app.",
  "icons": [{
    "src": "images/touch/homescreen48.png",
    "sizes": "48x48",
    "type": "image/png"
  }, {
    "src": "images/touch/homescreen72.png",
    "sizes": "72x72",
    "type": "image/png"
  }, {
    "src": "images/touch/homescreen96.png",
    "sizes": "96x96",
    "type": "image/png"
  }, {
    "src": "images/touch/homescreen144.png",
    "sizes": "144x144",
    "type": "image/png"
  }, {
    "src": "images/touch/homescreen168.png",
    "sizes": "168x168",
    "type": "image/png"
  }, {
    "src": "images/touch/homescreen192.png",
    "sizes": "192x192",
    "type": "image/png"
  }],
  "related_applications": [{
    "platform": "play",
    "url": "https://play.google.com/store/apps/details?id=cheeaun.hackerweb"
  }]
}

0 个答案:

没有答案