我不想再用本地托管的 jquery 库创建一个插件。我尝试从 Google 的 CDN 加载它,但遇到此异常:
Refused to load the script 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js' because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".
如何修复它?
最佳答案
如果您想从 Google 的 CDN 加载 jQuery,您必须将以下内容安全规则添加到您的 list 文件中。
...
"content_security_policy": "script-src 'self' https://*.googleapis.com; object-src 'self'",
...
有关更多信息,请阅读 Sirwan Afifi 已经提供的官方文档,特别是点击 CSP specification 的链接。和 article on HTML5 rocks .
关于jquery - 如何从 Google CDN 加载 jquery?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13443001/