我正在构建一个渐进式网络应用程序。我从样板开始创建反应应用程序 https://github.com/facebookincubator/create-react-app。然后我添加了一个网络应用程序清单。
应用程序/公共/manifest.json
{
"short_name": "First Contributions",
"name": "First Contributions",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone",
"start_url": "index.html"
}
将此链接到index.html
应用程序/公共/index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<title>First Contributions</title>
</head>
<body>
<div id="root"></div>
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js').catch(function(ex) {
console.warn(ex);
console.warn('(This warning can be safely ignored outside of the production build.)');
});
}
</script>
</body>
</html>
我已经使用生成了图标realfavicongenerator.net
并将它们放入公共目录中。
我正在使用部署我的应用程序gh-pages
。当我尝试Add to homescreen
,我收到以下错误
- android-chrome-192x192.png:1 获取https://roshanjossey.github.io/android-chrome-192x192.png https://roshanjossey.github.io/android-chrome-192x192.png404(未找到)
- 尝试使用清单中的以下图标时出错:https://roshanjossey.github.io/android-chrome-192x192.png https://roshanjossey.github.io/android-chrome-192x192.png(下载错误或资源不是有效图像)
- 站点无法安装:没有可显示的图标
我认为我在图标的 webmanifest 中做错了什么。