最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Content Security Policy directive: "script-src 'self' 'unsafe-eval'&qu

programmeradmin6浏览0评论

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 '…22+and+xpath%3D%22*%22+and+pat%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.

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./v1/public/yql?callback=jQuery1111091462301090359…22+and+xpath%3D%22*%22+and+pat%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.

Share Improve this question edited Dec 1, 2014 at 10:45 Xan 77.7k18 gold badges197 silver badges217 bronze badges asked Dec 1, 2014 at 9:39 Rocking MeRocking Me 1621 gold badge2 silver badges11 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

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.

Add the yahoo domain to the rule: "script-src 'self' 'unsafe-eval' http://query.yahooapis."

For more information: http://content-security-policy./

发布评论

评论列表(0)

  1. 暂无评论