微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么浏览器无法加载 manifest.webmanifest 并且服务器在发布 PWA 时响应错误 404?

如何解决为什么浏览器无法加载 manifest.webmanifest 并且服务器在发布 PWA 时响应错误 404?

我正在尝试在 Azure 上发布一个使用 angular 8 制作的简单 PWA。 我在 index.html 文件链接了 manifest.webmanifest。 这里有 HTML:

 <!doctype html>
<html lang="en">
<head>
  <Meta charset="utf-8">
  <title>LogSystemApp</title>
  <base href="/">
  <Meta name="viewport" content="width=device-width,initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
  <link rel="manifest" href="manifest.webmanifest">
  <Meta name="theme-color" content="#1976d2">
</head>
<body>
  <app-root></app-root>
  <noscript>Please enable JavaScript to continue using this application.</noscript>
<script src="runtime-es2015.js" type="module"></script><script src="runtime-es5.js" nomodule defer></script><script src="polyfills-es5.js" nomodule defer></script><script src="polyfills-es2015.js" type="module"></script><script src="styles-es2015.js" type="module"></script><script src="styles-es5.js" nomodule defer></script><script src="vendor-es2015.js" type="module"></script><script src="vendor-es5.js" nomodule defer></script><script src="main-es2015.js" type="module"></script><script src="main-es5.js" nomodule defer></script></body>
</html>

清单文件位于 index.html 级别。 在 ftp 文件夹中,我可以看到这两个文件。 清单是:

{
  "name": "LogSystemApp","short_name": "LogSystemApp","theme_color": "#1976d2","background_color": "#fafafa","display": "standalone","scope": "./","start_url": "./","icons": [
    {
      "src": "assets/icons/icon-72x72.png","sizes": "72x72","type": "image/png","purpose": "maskable any"
    },{
      "src": "assets/icons/icon-96x96.png","sizes": "96x96",{
      "src": "assets/icons/icon-128x128.png","sizes": "128x128",{
      "src": "assets/icons/icon-144x144.png","sizes": "144x144",{
      "src": "assets/icons/icon-152x152.png","sizes": "152x152",{
      "src": "assets/icons/icon-192x192.png","sizes": "192x192",{
      "src": "assets/icons/icon-384x384.png","sizes": "384x384",{
      "src": "assets/icons/icon-512x512.png","sizes": "512x512","purpose": "maskable any"
    }
  ]
}

当我在 Azure 上通过 Visual Studio 在控制台中发布 PWA 时,我看到错误

“加载资源失败:服务器响应状态为 404(未找到).... manifest.webmanifest” 和: “清单:行:1,列:1,语法错误。”

WebApp 运行良好,但我无法利用 PWA。

到处寻找有关此问题的解决方案,但没有找到。 有人知道更多或我错在哪里吗? 谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。