拒绝加载脚本,因为它违反了以下内容安全策略指令:“script-src'self' [英] Refused to load the script because it violates the following Content Security Policy directive: "script-src 'self'

查看:312
本文介绍了拒绝加载脚本,因为它违反了以下内容安全策略指令:“script-src'self'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个chrome appplication,其中我想显示一个自定义的Rss提要但是不会加载提要和上面的显示错误。





错误详情





拒绝加载脚本
'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'
,因为它违反了以下内容内容安全政策指令:
script-src'self'
https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js。

拒绝执行内联脚本,因为它违反了以下内容安全策略指令:script-src'self'
https://ajax.googleapis.com/ajax/libs/jquery/ 1.4.1 / jquery.min.js。
jquery.min.js:35

拒绝加载脚本'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js '
因为它违反了以下内容安全策略指令:
script-src'self'
https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/ jquery.min.js。

拒绝加载脚本'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=2&output=json&q=http%3A %2F%2Fblog.tax2290.com%2Ffeed%2F& hl = en& callback = jsonp1373953012503'
因为它违反了以下内容安全策略指令:
script-src'self'
https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js。





 Manifest.json 





 {
name :Tax New 2290,
manifest_version:2,
version:1.1,
description:Tax 2290,
web_accessible_resources: [images / logo.png],
图标:{
16:icon16.png,
19:icon19.png,
48:icon48.png,
128:icon128.png,
256:icon256.png
},
browser_action :
{
default_icon:images / logo.png,
default_popup :index.html
},

权限:[标签,< all_urls>,http://www.tax2290.com,http :// * / *,https:// * / *,http://*.google.com/],
content_security_policy:script-src'self'https:/ /ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js; https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js; object-src'self'

}





 index.html 



< html xmlns =http://www.w3.org/1999/xhtml> 
< ; head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< script type =text / javascriptsrc =https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min。 js>< / script>
< script type =text / javascriptsrc =https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min。 js>< / script>
< script type =text / javascriptsrc =images / feed.js>< / script>
< link rel =stylesheet href =images / style.csstype =text / css/>
< title> Chrome Popup< / title>
< / head>



 Feed.js 



 $( function (){
var $ items = $(' #vtab> ul> li');
$ items.mouseover( function () {
$ items.removeClass(' selected');
$( this )。addClass(' selected');

var index = $ items.index($( this ));
$(' #vtab> div')。hide()。eq(index) 。节目();
})。eq( 0
)。mouseover();
});


$( document )。ready( function () {
$(' #divRss2')。FeedEk({
FeedUrl: ' http://blog.tax2290.com/feed/'
MaxCount:< span class =code-digit> 2 ,ShowDesc: true
ShowPubDate: true
DescCharacterLimit: 250
});
});



请告诉我如何避免这些错误并加载自定义RSS源。

解决方案

function (){
var


items =


' #vtab> UL>礼);

I am trying to develop a chrome appplication in which i want to display a custom Rss feeds but feeds are not get loaded and dispalying error like above.



Error Details



Refused to load the script
 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'
 because it violates the following Content Security Policy directive:
 "script-src 'self'
 https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js".

     Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'
 https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js". 
 jquery.min.js:35

     Refused to load the script 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'
 because it violates the following Content Security Policy directive:
 "script-src 'self'
 https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js".

     Refused to load the script 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=2&output=json&q=http%3A%2F%2Fblog.tax2290.com%2Ffeed%2F&hl=en&callback=jsonp1373953012503'
 because it violates the following Content Security Policy directive:
 "script-src 'self'
 https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js".



Manifest.json



{
      "name": "Tax New 2290",
      "manifest_version": 2,
      "version": "1.1",
      "description": "Tax 2290",
    "web_accessible_resources": ["images/logo.png"],
      "icons": {
        "16": "icon16.png",
        "19":"icon19.png",
        "48": "icon48.png",
        "128": "icon128.png",
        "256": "icon256.png"
    },
     "browser_action":
    {
    "default_icon":"images/logo.png",
    "default_popup":"index.html"
    },

         "permissions": ["tabs", "<all_urls>","http://www.tax2290.com","http://*/*", "https://*/*","http://*.google.com/"],
        "content_security_policy": "script-src 'self' https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js; https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js; object-src 'self'"

    }



index.html


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="images/feed.js"></script>
<link rel="stylesheet" href="images/style.css" type="text/css"  />
<title>Chrome Popup</title>
</head>


Feed.js


$(function() {
             var $items = $('#vtab>ul>li');
             $items.mouseover(function() {
                 $items.removeClass('selected');
                 $(this).addClass('selected');

                 var index = $items.index($(this));
                 $('#vtab>div').hide().eq(index).show();
             }).eq(0).mouseover();
         });


 $(document).ready(function () {
    $('#divRss2').FeedEk({
         FeedUrl: 'http://blog.tax2290.com/feed/',
         MaxCount: 2,ShowDesc: true,
         ShowPubDate: true,
         DescCharacterLimit: 250
     });
 });


Please tel me how could avoid these errors and load the custom RSS feeds.

解决方案

(function() { var


items =


('#vtab>ul>li');


这篇关于拒绝加载脚本,因为它违反了以下内容安全策略指令:“script-src'self'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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