如何在Chrome扩展中使用YUI3? [英] How do I use YUI3 in a Chrome extension?

查看:206
本文介绍了如何在Chrome扩展中使用YUI3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我下载缩小的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆