title: Remove adsense on mobile
body: <p>I'm working on my responsive design but having trouble with adsense.</p>
  
  <p>I have an ad which should show up on the desktop design, but not on the mobile design.
  So the code of the ad should be placed in the html only if the website is viewed on a desktop.
  It's possible with css using display: none, but this is against adsense TOS, so not a solution.</p>
  
  <p>I think it's possible with a PHP class like <a href="http://mobiledetect.net" rel="noreferrer">http://mobiledetect.net</a> but I prefer to check the browser width and then decide what to do.</p>
  
  <p>Adsense has an approved example as below, but can I use it for my goal?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  google_ad_client = "ca-publisher-id";
  width = document.documentElement.clientWidth;
  google_ad_slot = "1234567890";
  google_ad_width = 320;
  google_ad_height = 50;
  if (width &gt; 500) {
      google_ad_slot = "3456789012";
      google_ad_width = 468;
      google_ad_height = 60;
  }
  if (width &gt; 800) {
      google_ad_slot = "2345678901";
      google_ad_width = 728;
      google_ad_height = 90;
  }
  &lt;/script&gt;
  &lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I hope someone can point me in the right direction.</p>