我遇到了这个错误,我想知道我的清单是否设置正确..还是有更好的方法让jquery执行。
拒绝加载脚本“https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”,因为它违反了以下内容安全策略指令:“default-src'self'chrome-extension-resource:”。请注意,'script-src'未明确设置,因此'default-src'用作后备。
"sandbox": {
"pages": [
"open.html"
]
"content_security_policy":
"sandbox allow-scripts; script-src https://ajax.googleapis.com"
],
}
// open.html
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="open.js"></script>
</head>
<body>
</body>
</html>
答案 0 :(得分:0)
你能发布整个清单吗?您似乎正在运行Chrome应用程序,这是新形式的打包应用程序。 Chrome应用不允许您更改内容安全策略。 (source)因此,您必须将jQuery文件下载到应用程序的文件夹中,并将其作为本地文件引用。