0

yql api를 호출하려고합니다. 그러나 오류가 : 나는 내가 w /은 "content_security_policy" 을 가진 O를 그 일을 시도하지만 여전히 오류가 발생하는 것입니다 크롬 확장 프로그램 : yql API 오류 : 콘텐츠 보안

Manfiest.json: 
"content_security_policy": "script-src 'self'; object-src 'self'", 

Error: 
Refused to load the script 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where…withkeys&callback=jQuery20208888747137971222_1400373036635&_=1400373036638' because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".' 

다음있다. 나는 CSP ( https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-remote-script) 에서 찾고있다하지만 내 manifest.json을 추가 할 필요가 무엇인지 이해하지 못하는

yqlAPI = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + ' &format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=?'; 

$.getJSON(yqlAPI, function(r){ 
$.each(r.query.results.li, function(){ 
    if(typeof this.font !== 'undefined') 
     {   
     gogoAnime1.push([this.a.href,this.font.content]); 

     } 
}); 
gotFollowersOfA(gogoAnime1);}); 

: 전화를 할

코드입니다. 그것이 모든 도움을 주시면 감사하겠습니다!

답변

0

외부 객체를 요청했기 때문에 그럴 지 모르겠습니다.

If you have a need for some external JavaScript or object resources, you can relax the policy to a limited extent by whitelisting secure origins from which scripts should be accepted.

Content Security Policy (CSP) - Google Chrome

그렇게 manfiest.json, 적절하게 조정합니다

"content_security_policy": 
     "script-src 'self'; object-src 'self' https://query.yahooapis.com/" 

그리고 당신은 HTTPS 원산지를 사용해야합니다 : 당신이 말한 것을 시도

As man-in-the-middle attacks are both trivial and undetectable over HTTP, those origins will not be accepted. Currently, we allow whitelisting origins with the following schemes: HTTPS, chrome-extension, and chrome-extension-resource.

+0

. 하지만 대신 다음을 얻었습니다 http://gyazo.com/c8909bf62f0fe22170e05ec5809bfe45 – user3537288

+0

@ user3537288 https를 사용해야합니다. http 소스가 허용되지 않습니다. yql은 https에서 사용할 수 있습니다. 업데이트 된 답변을 사용해 볼 수 있습니까? 감사합니다 – rkansola

+0

OMG! 그것은 효과가 있었다. 나는 "script-src 'self'https://query.yahooapis.com/; object-src 'self'" 정말 고마워! https로 전화를 걸 수 있는지 알지 못했습니다. 그래서 나는 단지 js에서 그것을 바꿨고 효과가있었습니다! – user3537288