将sharethis按钮添加到chrome扩展popup.html
Adding sharethis buttons to chrome extension popup.html
我试图将sharethis按钮添加到popup.html中,出现以下错误:
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://*.sharethis.com". Either the 'unsafe-inline' keyword, a hash ('sha256-9kQ6Bjy+HAjxIkWKadVLttYAH2WuOVEKCHY7pnlgMz0='), or a nonce ('nonce-...') is required to enable inline execution.
这是我的conf:"content_security_policy": "script-src 'self' 'unsafe-eval' https://*.sharethis.com; object-src 'self'"
有人设法让那些按钮出现了吗?
感谢
unsafe-eval
用于放松eval
函数,如setTimeout(String)
、setInterval(String)
和new Function(String)
。
根据官方指南,unsafe-inline
不会有任何影响
直到Chrome45,还没有任何机制可以放松对执行内联JavaScript的限制。特别是,设置包含"不安全内联"的脚本策略将无效。
对于铬>46,
通过在策略中指定源代码的base64编码哈希,可以将内联脚本列入白名单。此哈希必须以使用的哈希算法(sha256、sha384或sha512)为前缀。有关示例,请参阅元素的哈希用法。
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- 扩展移相器按钮类不工作
- chrome扩展中的navigator.geolocation.getCurrentPosition
- chrome扩展:尽管运行了at:documentidle,js脚本还是过早启动
- chrome扩展更改主机/域警告
- TableExport jquery插件:文件名和扩展名问题
- 从popup.js|Chrome扩展访问DOM
- 从Chrome扩展名中的popup.html文件在background.js文件中运行一个函数
- 单击扩展图标时打开popup.html
- 将sharethis按钮添加到chrome扩展popup.html
- 当单击<a>链接在chrome扩展中,popup.html如何保持打开状态
- Chrome扩展如何将数据从内容脚本发送到popup.html
- 弹出窗口.js 未在 Chrome 扩展程序中的 Popup 的头部标签中执行.html Popup
- 如何查询外部域,将其存储在chrome扩展中,并调用它在popup.html中显示
- 如何请求在popup.html中显示chrome扩展的清单版本号
- 以chrome扩展名调整popup.html的大小
- 将Chrome扩展popup.html页面重定向到Oauth的URL
- Chrome扩展帮助:从popup.html触发变量CSS
- Chrome扩展sendMessage从popup.html到content.js不工作
- 对于chrome扩展,main.js如何从popup.js调用函数