adsense
I want to add adsense ads to be shown to visitors on desktop only.
我想添加adsense广告,仅在台式机上显示给访问者。
How to remove AdSense ads for mobile devices?
如何删除移动设备上的AdSense广告?
You can achieve this through using “Responsive ad unit” of AdSense.
您可以使用AdSense的“自适应广告单元”来实现这一目标。
The support article Create a responsive ad unit from AdSense discusses this and gives an example. Check the “Hiding an ad unit” section.
支持文章“ 使用 AdSense 创建自适应广告单元”对此进行了讨论,并提供了示例。 选中“隐藏广告单元”部分。
I highlight the important parts here:
我在这里重点介绍重要部分:
<style type="text/css">
@media (max-width: 400px) { .adslot_1 { display: none; } }
</style>
<ins class="adsbygoogle adslot_1"
data-ad-client="ca-pub-1234"
data-ad-slot="5678"></ins>
Note that it deleted the default style="display:block;"
from the <ins></ins>
tag.
请注意,它删除了默认style="display:block;"
从<ins></ins>
标记中。
adsense