内容安全策略指令:“script-src”self''unsafe-eval'“ [英] Content Security Policy directive: "script-src 'self' 'unsafe-eval'"

查看:4836
本文介绍了内容安全策略指令:“script-src”self''unsafe-eval'“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 urlive 库来加载使用链接的缩略图。



功能完美。但是,在Chrome扩展中运行相同的功能时,我收到错误消息:


拒绝加载脚本 http://query.yahooapis.com/v1/public/yql?callback=jQuery1111091462301090359...22+and+xpath%3D%22*%22+and+compat%3D%22html5%22&format=xml&_= 1417426473922',因为它违反了以下内容安全策略指令:script-src'self''unsafe-eval'。




  $(document).ready(function(){
$('#thumbnail_url') .on('input propertychange',function(){
console.log('called');
$('#thumbnail_url')。urlive({
callbacks:{
onStart:function(){
console.log('called1');
$('。loading')。show();
$('。urlive-container')。 urlive('remove');
},
onSuccess:function(data){
$('。loading')。hide();
$('。urlive-container')。urlive('remove');
},
noData:function(){
$('。loading')。hide();
$('。urlive-container')。urlive('remove');
}
}
});
})。trigger('input');
});

我尝试了所有可能性。但我没有得到答案。仍然在调用 yahooapis 时引发错误。

解决方案

如果你正在处理chromeapp,然后忘记 urlive 库。 urlive将采用yahooapis,而yahooapis不适用于构建Chrome应用。它不断提高错误。所以最好去其他图书馆。


I am using urlive library to load thumbnail images using the link.

Outside of a Chrome extension the functionality works perfect. But while running the same functionality in a Chrome extension I was getting the error:

"Refused to load the script 'http://query.yahooapis.com/v1/public/yql?callback=jQuery1111091462301090359…22+and+xpath%3D%22*%22+and+compat%3D%22html5%22&format=xml&_=1417426473922' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'".

$(document).ready(function() {
  $('#thumbnail_url').on('input propertychange', function () {
    console.log('called');
    $('#thumbnail_url').urlive({
      callbacks: {
        onStart: function () {
          console.log('called1');
          $('.loading').show();
          $('.urlive-container').urlive('remove');
        },
        onSuccess: function (data) {
          $('.loading').hide();
          $('.urlive-container').urlive('remove');
        },
        noData: function () {
          $('.loading').hide();
          $('.urlive-container').urlive('remove');
        }
      }
    });
  }).trigger('input');
});

I have tried all the possibilities. But I did not get the answer. Still the error raising for me while calling the yahooapis.

解决方案

If you are dealing with the chromeapp then forget about urlive library. The 'urlive` will take the yahooapis and the yahooapis doesn't work on building the chrome app. It keeps raising the error. So better go with other library.

这篇关于内容安全策略指令:“script-src”self''unsafe-eval'“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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