2017-10-14 134 views
0

的getJSON我想無法從第三方網站

https://www.g2a.com/lucene/search/quick?jsoncallback=jQuery1110048787688104918936_1507980736882&phrase=punch&isWholesale=false&cc=PL&skip=&start=0&rows=5&_=1507980736886

它是在搜索框搜索上G2A的響應。我嘗試這樣做:

$.ajax({ 
url: url, 
type: "GET", 
dataType: "jsonp", 
success: function (data) { 
    console.log(data); 
}}); 

但我得到一個錯誤:

jquery-3.2.1.min.js:4 Refused to load the script 'https://www.g2a.com/lucene/search/quick?jsoncallback=jQuery1110048787688104918936_1507980736882&phrase=s&isWholesale=false&cc=PL&skip=&start=0&rows=5&&callback=jQuery32104612888467884788_1507987847332&_=1507987847333' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". 

正如你可以看到它是一個Chrome擴展,因此它不能有一些PHP腳本,可以在網上找到。

回答

0

你將不得不添加像以下各項

"content_security_policy": "script-src 'self' https://www.g2a.com; object-src 'self'" 
在您menifest.json服務器的條目,東西