我为我的英语很抱歉,内容安全策略的getJSON
我在我的HTML这下面的代码:
<script type="text/javascript" src="plugin.js"></script>
在我的JS:
$(document).ready(function() {
$.getJSON("https://api.twitch.tv/kraken/streams/"+"NameOfStreamer"+"?callback=?",function(c) {
if (c.stream == null) {
$("p").text("Stream offline, n'hésitez pas à me rejoindre sur les réseaux sociaux afficher ci-dessous.");
} else {
$("p").text("Stream online, rejoins moi sur Domingo.tv en cliquant sur le lien ci dessous");
}
});
});
在我的清单:我得到:
Refused to load the script 'https://api.twitch.tv/kraken/streams/NameOfStreamer?callback=jQuery11120590793181443587_1429560015317&_=1429560015318' because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".
我想知道我该如何解决这个问题。
你做跨域Ajax请求。你需要jsonp或适当的CORS标题来允许它。 –
不正确的重复。这里的问题是jsonp。它需要被丢弃。 – Xan