dousi8931 2015-06-28 20:23
浏览 56
已采纳

如何仅在移动设备,平板电脑等上展示Adsense广告(在桌面上隐藏)

I have recently redesigned my website to a responsive design and everything is working great. The only issue is, the current desktop ads are incompatible with the responsive design. I have discovered a method to hide the desktop ads on mobile, but can;t seem to find a way to only show responsive ads on mobile,tablets,etc (anything but desktop) so that I can create new ad positions for these. My current adsense code is in the format

<script async src="//"></script>
<!-- MH Responsive -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-xxxxxxxx"
     data-ad-slot="xxxxxx"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

Any help on this matter would be greatly appreciated.

Kindest Regards

  • 写回答

1条回答 默认 最新

  • dongzhukuai8177 2015-06-28 20:33
    关注

    The way I would do it, I would use PHP code. Here is the code:

    (adsbygoogle = window.adsbygoogle || []).push({}); '; } }?>

    Place that script at the top of the page and when you want to show the ad just paste this script:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记