V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
needpp
V2EX  ›  问与答

chrome 插件开发 content_security_policy 有偿求助

  •  
  •   needpp · Dec 21, 2022 · 753 views
    This topic created in 1226 days ago, the information mentioned may be changed or developed.

    想在谷歌插件中进行 pdf 下载,这个 pdf 是通过 pdfmake 生成的,但是遇到了 csp 问题;

    问题代码

    <iframe className='h-screen' src={pdfUrl}></iframe>
    
    

    bug 截图

    image

    尝试过的解决办法:

    1. 设置了 csp 白名单
      "content_security_policy": {
        "extension_pages": "child-src https: http: data: ;  script-src 'self' 'unsafe-inline'; object-src 'self' 'data:'; frame-src 'self' 'unsafe-inline' 'data:'"
      }
      
    

    但是似乎这些改动,没有体现到控制台;

    1. 排除其他原因: 把 iframe 中的 pdfUrl 固定写成 test.pdf ,能够正常展示

    2. 怀疑问题: 是否是 mainfestv3 版本导致?

    希望踩过坑的朋友分享下经验,把提供思路帮我解决问题也附上红包感谢;

    交个朋友,后续有问题会继续付费求助,谢谢

    needpp
        1
    needpp  
    OP
       Dec 21, 2022
    已解决,结贴
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2761 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 14:19 · PVG 22:19 · LAX 07:19 · JFK 10:19
    ♥ Do have faith in what you're doing.