简体   繁体   English

使用添加到主屏幕时 PWA 图标不可见

[英]PWA icons not visible on using add to home screen

I have added icons of different sizes (144x144 and 194x194) and created pwa-manifest.json -我添加了不同大小的图标(144x144 和 194x194)并创建了 pwa-manifest.json -

{
    "short_name": "app",
    "name": "Application",
    "icons": [
        {
            "src": "assets/images/favicons/favicon-194x194.png",
            "sizes": "194x194 512x512",
            "type": "image/png"
        },
        {
            "src": "assets/images/favicons/apple-touch-icon-144x144.png",
            "sizes": "144x144",
            "type": "image/png"
        }
    ],
    "start_url": "/index.html",
    "background_color": "#fbfcfd",
    "theme_color": "#00aeef",
    "display": "standalone"
}

I also have added this manifest file into index.html and angular-cli.json.我还将此清单文件添加到 index.html 和 angular-cli.json 中。

When I tried to add the application in Android 7.0 (using Chrome 61.0.3163.98) it's not showing the icon.当我尝试在 Android 7.0(使用 Chrome 61.0.3163.98)中添加应用程序时,它没有显示图标。 I have used different android devices only Motorola Nexus gives desired results.我使用了不同的 android 设备,只有 Motorola Nexus 给出了预期的结果。

Please try resetting your devices' cache and reloading the page multiple times.请尝试重置您设备的缓存并多次重新加载页面。 This happened to me one time and it was very aggravating!这种情况发生在我身上一次,非常令人恼火!

add these lines of code to the head of your index.html将这些代码行添加到 index.html 的头部

<link rel="apple-touch-icon" href="path/to/file.png"></link>
<link rel="shortcut icon" type="image/jpg" href="path/to/file.png"/>

This may isn't the best answer, but it works for me: add the app to home screen twice .这可能不是最佳答案,但对我有用:两次将应用程序添加到主屏幕 The icon will visible after that.之后该图标将可见。 (It's may an issue in some models related to the icons folder refreshing). (在某些与图标文件夹刷新相关的模型中,这可能是一个问题)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM