Forum Moderators: martinibuster
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive links -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-********************"
data-ad-slot="***************"
data-ad-format="link"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script> div.ads
{
margin: .4em;
padding: .3em;
text-align: center;
display: block;
}
@media only screen and (max-width: 767px) {
.ads {
display: none; }
} <div class="ads">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive links -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-********************"
data-ad-slot="***************"
data-ad-format="link"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive links -->
<script>
if(screen.width>728)
{
document.write('<ins class="adsbygoogle" ');
document.write('style="display:block" ');
document.write('data-ad-client="ca-pub-********************" ');
document.write('data-ad-slot="***************" ');
document.write('data-ad-format="link" ');
document.write('data-full-width-responsive="true"></ins>');
(adsbygoogle = window.adsbygoogle || []).push({});
}
</script>
The only way to be certain that the script is not executed is to follow the instructions in Rasputin's post.Not the only way, there are many ways not to load the ad. Yes, your example will load the ad, just not display it. Actually that's fine as I said, but there are ways that give you more control. The Google example does not give the site owner any control.
<style type="text/css">
.adslot_1 { display:inline-block; width: 320px; height: 50px; }
@media (max-width: 400px) { .adslot_1 { display: none; } }
@media (min-width:500px) { .adslot_1 { width: 468px; height: 60px; } }
@media (min-width:800px) { .adslot_1 { width: 728px; height: 90px; } }
</style>
<ins class="adsbygoogle adslot_1"
data-ad-client="ca-pub-***************"
data-ad-slot="************"></ins>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script> @media (max-width: 400px) { .adslot_1 { display: none; } } to this: @media (max-width: 415px) { .adslot_1 { display: none; } } that sets your ad script to "display: none;" for devices up to 415px width rather than the 400px width which was posted.
<style type="text/css">
.adslot_1 { display:inline-block; width: 320px; height: 90px; }
@media (max-width: 800px) { .adslot_1 { display: none; } }
@media (min-width:500px) { .adslot_1 { display: none; } }
@media (min-width:400px) { .adslot_1 { width: 300px; height: 200px; } }
</style>
<ins class="adsbygoogle adslot_1"
data-ad-client="ca-pub-1234"
data-ad-slot="5678"></ins>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>