如何在Chrome扩展中使用YUI3? [英] How do I use YUI3 in a Chrome extension?
问题描述
如果我下载缩小的YUI3加载程序并将其包含在我的background.html中,则会出现以下错误:
未捕获的EvalError:拒绝将字符串评估为JavaScript,因为'unsafe-eval'不是下列内容安全策略指令中允许的脚本源:script-srcself'chrome-extension-resource:。
YUI3可以用于扩展吗?
它看起来像阻止你使用eval()。请确保清单中包含以下行。
$ b
content_security_policy:script-src'self''unsafe-eval'; object -src'self'
If I download the minified YUI3 loader and include it in my background.html I get the following error:
Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".
Can YUI3 be used in an extension?
It looks like it's blocking you from using eval(). Make sure you have the following line in your manifest.
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
这篇关于如何在Chrome扩展中使用YUI3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!