最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Cross-Origin-Opener-Policy policy would block the window.postMessage call - Stack Overflow

programmeradmin6浏览0评论

After authenticating with Google in my React.js (CRA) app, I get the following error in the console:

Cross-Origin-Opener-Policy policy would block the window.postMessage call. I tried to fix it by adding the following headers in my serve.json file:

{
  "rewrites": [
    {
      "source": "*",
      "destination": "/index.html"
    }
  ],
  "headers": [
    {
      "source": "*",
      "headers": [
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "Cross-Origin-Opener-Policy",
          "value": "same-origin-allow-popups"
        },
        {
          "key": "Cross-Origin-Embedder-Policy",
          "value": "unsafe-none"`enter code here`
        }re      ]
    }
  ]
}

But it doesn't help — I still get the same error.

Is there any working solution for this?

发布评论

评论列表(0)

  1. 暂无评论