1
我想包括链接样式表使用谷歌字体的字体。我已经尝试过Web Font Loader和实际的链接样式表,但是我一直在收到CSP错误。谷歌Chrome应用程序使用谷歌字体
Refused to load the stylesheet 'http://fonts.googleapis.com/css?family=Open+Sans:400,300,600'
because it violates the following Content Security Policy directive:
"style-src 'self' data: chrome-extension-resource: 'unsafe-inline'".
这是我在我的manifest.json
"content_security_policy": "default-src 'self'; style-src 'unsafe-inline'; script-src 'self';",
CSP现在,因为,因为它似乎得到左,当我想也许可以阅读这个权利我没有看到关于CSP的整个文档有人可以启发我如何工作,我需要让我的样式表工作。
另一种方法我试过:
load({
method:"GET",
url:"http://fonts.googleapis.com/css?family=Open+Sans:400,300,600"
},function(data){
var style = document.createElement('style');
var head = document.head;
style.innerHTML = data.responseText;
head.insertBefore(style, head.firstChild);
});