提问人:CZ workman 提问时间:10/26/2023 最后编辑:jub0bsCZ workman 更新时间:10/26/2023 访问量:33
Web 应用清单:“related_applications”,并且已启用的 CORP 不会在 Android 上加载图像
Web App manifest: `related_applications` and enabled CORP does not load image on Android
问:
具有并启用了 CORS、CORP、COEP(我们的 Web 应用需要)的 Web 应用清单引发错误related_applications
Web 应用清单
...
"related_applications": [
{
"platform": "play",
"url": "xyz",
"id": "xyz"
},
],
"prefer_related_applications": true,
...
来自我们服务器的响应标头:
Cross-Origin-Opener-Policy: "same-origin"
Cross-Origin-Embedder-Policy: "require-corp"
Cross-Origin-Resource-Policy: "cross-origin"
CSP 包括:
...
img-src 'self' https://play-lh.googleusercontent.com
...
添加到 CSP,我们缓解了 CSP 报告仪表板 (uriports.com) 中的 CSP 错误。https://play-lh.googleusercontent.com
但是发生了另一个错误:
Type: corp
Error: This is a Cross-Origin-Resource-Policy violation. The loaded resource is cross-origin, but that was not allowed by the CORP policy in the header.
Destination: image
Blocked Url: https://play-lh.googleusercontent.com/xyz
当我在生产中手动更改映像时,在浏览器控制台中出现错误:src
GET https://play-lh.googleusercontent.com/xyz net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 400 (Bad Request)
另一方面,如果我添加一切正常,则一切正常。<img src="..." crossorigin />
我无法设置为图像或将标题更正为响应,这是由 Google 在 Android 上自动注入的。crossorigin
关于安装提示的文章:https://web.dev/learn/pwa/installation-prompt
如果我不想摆脱 COOP、CORP...,向用户显示安装提示的最佳方式是什么?
答: 暂无答案
评论