2016-07-22 59 views
4

按照谷歌开发者计划政策(https://developer.chrome.com/webstore/program_policies)它是完全可以接受的广告添加到您的浏览器扩展程序:哪些应用或扩展他们捆绑在一起将广告实施到Chrome扩展程序中?

广告必须在上下文中提出或明确规定。通过调整设置或完全卸载应用程序或扩展程序,广告也必须易于移除。广告不得模拟或模拟系统通知或警告。

因此,我正在尝试添加广告,并且因为AdSense不允许使用Chitika。我花了很长时间才开始接近有广告,我不得不编辑缩小的文件,还有更多,以符合Chrome扩展清单content_security_policy。总之,截至目前,只有1家公司的广告都出现了,但其余的被阻塞,出现错误消息:

getads.js:340 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' https://www.google-analytics.com https://secure.adnxs.com https://gum.criteo.com https://ib.adnxs.com https://mm.chitika.net https://cdn.chitika.net". Either the 'unsafe-inline' keyword, a hash ('sha256-KaerrywnDX+trLhtIG9qlTDyP6iiK4PCLN7LWCvctFc='), or a nonce ('nonce-...') is required to enable inline execution.

我能做些什么来解决这个问题?我试着加入keyworkd unsafe-inline,但我只是得到的另一个错误消息:

Ignored insecure CSP value "'unsafe-inline'" in directive 'object-src'.

我可以在这一点上做什么?我并不真正控制广告如何嵌入到我的软件中,所以我受到一定的限制。任何人有想法?如果没有,是否还有另一个适用于Chrome扩展程序的广告平台?我不想要任何烦人的东西......只是一个320x50的广告或其他东西......它变得如此令人沮丧,因为我每月在我的Chrome扩展上获得了800万页的印象,而且我无法创造任何收入!

感谢您的帮助。

编辑:这是我的广告代码:

(function() { 
if (window.CHITIKA === undefined) { window.CHITIKA = { 'units' : [] }; }; 
var unit = {"calltype":"async[2]","publisher":"USER_NAME","width":300,"height":250,"sid":"Chitika Default"}; 
var placement_id = window.CHITIKA.units.length; 
window.CHITIKA.units.push(unit); 
document.write('<div id="chitikaAdBlock-' + placement_id + '"></div>'); 
}()); 

,你必须包括:

<script type="text/javascript" src="../../js/getads.js" async></script>它可以在这里找到:http://cdn.chitika.net/getads.js。我用https版本替换了所有的域名。

编辑2:我content_security_policy看起来是这样的:

"content_security_policy": "script-src 'self' https://www.google-analytics.com https://secure.adnxs.com https://gum.criteo.com https://ib.adnxs.com https://mm.chitika.net https://cdn.chitika.net; object-src 'self'", 
+1

尝试将广告嵌入到iframe中。也许可以给CSP添加'frame-src'none''。我只是猜测。 – wOxxOm

+0

您可以显示广告代码吗? –

+1

你见过Google的[内容安全策略](https://developer.chrome.com/extensions/contentSecurityPolicy)和[这个SO问题]吗?(http://stackoverflow.com/questions/31060722/cordova-refuse-to-执行内联事件处理程序,因为,它-违反了最followi)? –

回答

0

developer program policies网站上,你可以找到遵循一句话:

目前,AdSense可能无法使用Chrome浏览器扩展 或Chrome应用来投放广告,每AdSense policies

所以实际上这意味着现在你不能在你的Chrome扩展中使用广告。