1
크롬 확장에 adsense 코드를 추가하고 싶습니다 (manifest_version : 2).크롬 확장에 애드 센스 코드를 추가하려면 어떻게해야합니까?
나는 내가 광고에 대한 블록 전용이있는 popup.html 페이지가 있습니다
<div id="adblock">
<script type="text/javascript"><!--google_ad_client = "ca-pub-xxxxxx";/* Getfiles Chrome Extn Banner 468x60 */google_ad_slot = "xxxxxx"; google_ad_width = 468;google_ad_height = 60;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
을하지만이 실행될 때 오류 다음 생성
Refused to load the script 'http://pagead2.googlesyndication.com/pagead/show_ads.js' because it violates the following Content Security Policy directive: "script-src 'self' https://pagead2.googlesyndication.com/pagead/show_ads.js".
그것은 때문이다 인라인 자바 스크립트를 금지하는 새로운 콘텐츠 보안 정책 내가 확장자를 다시로드하고 확장 브라우저가 중단 아이콘 팝업 doesnot 열기를 클릭하면 popup.js이
document.addEventListener('DOMSubtreeModified', function() {
var x = chrome.extension.getViews({type:"popup"});
rowOutput='<script type="text/javascript"><!--google_ad_client = "ca-pub-xxxx";/* Getfiles Chrome Extn Banner 468x60 */google_ad_slot = "xxxx"; google_ad_width = 468;google_ad_height = 60;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
if (x.length>0){
x[0].document.getElementById('adblock').innerHTML=rowOutput;
}
}, true);
파일에
내가 그 코드를 만들려고 한이 문제를 극복하기 위해. 이"content_security_policy": "object-src 'unsafe-eval'; script-src 'unsafe-eval' https://pagead2.googlesyndication.com; connect-src *"
는 "S"추가 다음으로 https 매니페스트 추가 변화
과에서