javascript - Google Adsense Error "TagError: adsbygoogle.push() error: No slot size for availableWidth=0 " -


i'm using responsive google ads on website unfortunately not working time , of time returning

tagerror: adsbygoogle.push() error: no slot size availablewidth=0

i tried fix issue defining ad sizes still issue not resolved yet.

.adslot_1 { width: 320px; height: 100px; } @media (min-width:500px) { .adslot_1 { width: 468px; height: 60px; } } @media (min-width:800px) { .adslot_1 { width: 728px; height: 90px; } } @media screen , (min-width:800px)and (max-width:3000px) {     #topbanner {         width: 640px;         height: 90px;     } } 

well, actual google adsense google code i've used (for security reasons i've remove pub-id , ad-slot.)

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- articles(auto) --> <ins class="adsbygoogle adslot_1"      style="display:inline-block;"      data-ad-client="ca-pub-[my_ad_id]"      data-ad-slot="ad_slot_nos"      data-ad-format="rectangle, horizontal"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> 

in our case, had problem displaying 2 banners in chrome. first banner not show , generate error:

no slot size availablewidth=0

the second banner displayed ok. problem not happening in safari or firefox. trying fix problem via css didn't help.

we solved problem changing the:

(adsbygoogle = window.adsbygoogle || []).push({}) 

to

$(document).ready(function(){(adsbygoogle = window.adsbygoogle || []).push({})}) 

jquery required above method.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -