I am trying to add an AdSense responsive ad to a mobile site, but I am getting the following error:
Cannot find a responsive size for a container of width=0px and data-ad-format=auto
Site is a mobile site built using JQuery Mobile 1.3. I set the width to the banner div. I want to add a banner inside ul:
<li>
<div style="width: 100%">[Banner]</div>
</li>
I added a similar banner to another view and it works great. Has anyone had this problem? Thank.
[EDIT] Well, if someone has this error, the solution I found is to change the AdSense ad code and change the style manually, for example, the following code:
<style>
.banner { width: 300px; height: 250px; }
@media(min-width: 360px) { .banner { width: 336px; height: 280px; } }
@media(min-width: 500px) { .banner { width: 468px; height: 60px; } }
@media(min-width: 800px) { .banner { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle banner"
style="display:inline-block"
data-ad-client="xxxx"
data-ad-slot="xxxx"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>'
Thank.
source
share