我正在为Rss阅读器创建一个chrome扩展,因为我收到了上面的错误。请帮忙
显示json
{
"name": "Tutorialzine Extension",
"manifest_version": 2,
"version": "1.1",
"description": "Making your first Google Chrome extension.",
"icons": {
"128": "icon_128.png"
},
"web_accessible_resources": ["script.js", "https://query.yahooapis.com"],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "tutorialzine.html"
},
"permissions": ["tabs", "<all_urls", "http://localhost/",
"http://*/*", "https://*/*", "https://query.yahooapis.com"],
"content_security_policy": "script-src 'self'; 'https://query.yahooapis.com';unsafe-inline; object-src 'self'"
}
script.js
$(document).ready(function () {
var query = "SELECT * FROM feed WHERE url='http://feeds.feedburner.com/Tutorialzine' LIMIT 2";
// Storing the seconds since the epoch in now:
var now = (new Date()).getTime() / 1000;
// If there is no cache set in localStorage, or the cache is older than 1 hour:
if (!localStorage.cache || now - parseInt(localStorage.time) > 1 * 60 * 60) {
$.get("yahoo.js", function (msg) {
// msg.query.results.item is an array:
var items = msg.query.results.item;
var htmlString = "";
for (var i = 0; i < items.length; i++) {
var tut = items[i];
// Extracting the post ID from the permalink:
var id = tut.guid.content.match(/(\d+)$/)[0];
// Looping and generating the markup of the tutorials:
htmlString += '<div class="tutorial">\
<img src="http://tutorialzine.com/img/posts/' + id + '.jpg" />\
<h2>' + tut.title + '</h2>\
<p>' + tut.description + '</p>\
<a href="' + tut.link + '" target="_blank">Read more</a>\
</div>';
}
// Setting the cache
localStorage.cache = htmlString;
localStorage.time = now;
// Updating the content div:
$('#content').html(htmlString);
}, 'json');
} else {
// The cache is fresh, use it:
$('#content').html(localStorage.cache);
}
}
jquery中出现错误。min.js:
Jquery。min.js包含内联脚本要做什么
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
如果您的htaccess中有此代码,这可能是一个原因。这可以解决您的问题
<IfModule mod_headers.c>
Header set Content-Security-Policy "script-src 'self' https://www.example.com/"
</IfModule>
在使用LinkedIn oAuth API时,我也遇到了此类问题。
我在使用linkedIn API时对cordova进行了以下设置
config.xml
<access origin="*" launch-external="yes"/>
<allow-navigation href="*" />
元标签是
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
剧本
<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script>
当我在模拟器上运行应用程序时
修复了将uri添加到meta标签http://platform.linkedin.com问题
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' http://platform.linkedin.com ">
我正在学习将Cordova与jquery mobile结合使用,我有以下错误: 拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“默认src“self”数据:间隙:https://ssl.gstatic.com “不安全评估”。启用内联执行需要'unsafe inline'关键字、哈希('sha256-iacGaS9lJJpFDLww4DKQsrDPQ2lxppM2d2GGnzCeKkU=')
问题内容: 当我尝试将我的应用程序部署到5.0.0以上的android系统的设备上时,我一直收到以下错误消息: 07-03 18:39:21.621:D / SystemWebChromeClient(9132):file:///android_asset/www/index.html:第0行:拒绝加载脚本“ http:// xxxxx ”,因为它违反了以下内容安全策略指令:“ script-sr
当我尝试将我的应用程序部署到Android系统高于5.0.0(Lollipop)的设备上时,我不断收到以下错误消息: 07-03 18:39:21.621:D/SystemWebChromeClient(9132):file:///android_asset/www/index.html: 第0行:拒绝加载脚本的http://xxxxx'因为它违反了以下内容安全策略指令:“script src's
因此,在大约1小时内,我的扩展失败了。 我在做我的扩展,它在做我假装的事情。我做了一些更改,由于不喜欢,我删除了它们,现在我的扩展抛出错误: 拒绝应用内联样式,因为它违反了以下内容安全策略指令:“default src‘self’”。请注意,没有显式设置“style src”,因此使用“default src”作为回退。 是什么导致了这个错误? 我在以下方面进行了更改: popup.html po
我尝试通过cryptojs库加密用户数据,并通过ajax发送到服务器,但控制台显示错误: 拒绝加载脚本'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js',因为它违反了以下内容安全策略指令:脚本-src'自我'https://apis.google.com'不安全评估'。请注意,没有显式设置脚本-src-
我已经在visual studio 2015 professional中创建了新的ASP.NET MVC5项目,并在内容安全策略的布局中添加了元标记,如下所示- 现在,当我运行我的应用程序,我得到以下错误在chrome浏览器控制台- 拒绝应用内联样式,因为它违反了以下内容安全策略指令:“样式-src'self'”。'unsafe-inline'关键字、散列('sha256-cwe3bg0vyqoi
我们开始吧:我是谷歌chrome扩展开发的新手,所以请容忍我。 我有一个分机,它给了我以下错误: 拒绝框架'https://api.xxx.jp/',因为它违反了以下内容安全策略指令:"frame-src'自己'https://staticxx.facebook.comhttps://twitter.comhttps://*.twimg.comhttps://5415703.fls.doublec
我得到了这个错误: 尝试加载mapboxGL地图时。这是我的CSP标签: