内容安全策略指令:“script-src’self”unsafe-eval’”
我正在使用urlive
库来使用链接加载缩略图。
在Chrome扩展程序之外,该function非常完美。 但是在Chrome扩展程序中运行相同的function时,我收到了错误消息:
“拒绝加载脚本
'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'".
'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
,我仍然yahooapis
。
如果你正在处理chromeapp然后忘记urlive
库。 ‘urlive`将采用yahooapis,yahooapis无法构建chrome应用程序。 它不断提高错误。 所以最好去其他图书馆。
将yahoo域添加到规则: "script-src 'self' 'unsafe-eval' http://query.yahooapis.com"
有关更多信息: http : //content-security-policy.com/