简体   繁体   English

如何在使用addon sdk时将内容安全策略添加到firefox扩展?

[英]How to add Content Security Policy to firefox extension when using addon sdk?

I am using firefox add-on sdk to convert my chrome extension to a firefox addon. 我使用firefox附加sdk将我的chrome扩展转换为firefox插件。 But I am getting Content Security Policy: The page's settings blocked the loading of a resource at data:text/html;charset=utf-8 error. 但是我得到了Content Security Policy: The page's settings blocked the loading of a resource at data:text/html;charset=utf-8错误。 I am injecting a local html in an iframe following this link . 我在这个链接后面的iframe中注入一个本地html。 Any idea how to achieve this? 知道怎么做到这一点? For chrome extension I followed this link . 对于chrome扩展,我按照此链接

I found a solution that works for me. 我发现了一个适合我的解决方案。

I add to my package.json the following line: 我在package.json中添加以下行:

"permissions": {
    "cross-domain-content": ["https://www.foo.com/"]
},

Where https://www.foo.com you can add the domain or the list of domains that you are accessing. https://www.foo.com您可以在其中添加您正在访问的域或域列表。

For more info go to the Cross Domain Content Scripts 有关更多信息,请转到跨域内容脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM