bobo2
V2EX  ›  问与答

有没有用过 workbox 的好哥哥遇到在 Firefox 中报 cors 的

  •  
  •   bobo2 · Jun 12, 2022 · 1346 views
    This topic created in 1429 days ago, the information mentioned may be changed or developed.

    如题,在 Chrome 一切正常,在 Firefox 中,如果 sw 还没注册,页面显示正常,sw 的 registry 事件也提示注册成功,但是刷新后就不行了,页面引入的资源和接口都报错 Cross-Origin Request Blocked: The Same Origin Policy disallowed reading the remote resource at <资源地址> (Reason: CORS request did not success).Status code: (null).

    页面引入的资源加了 crossorigin="anonymous"

    感觉无从下手,文档和 Google 页面,也没找到一些有效的解决办法,求好哥哥们解惑

    bobo2
        1
    bobo2  
    OP
       Jun 13, 2022
    破案了,firefox 使用 fetch 必须要显式加 header ,即使不需要加额外 header 字段,否则就会报 cors...折腾了我一周,气死
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1009 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 19:44 · PVG 03:44 · LAX 12:44 · JFK 15:44
    ♥ Do have faith in what you're doing.