This question is not on how to remove AdSense, but if I can remove AdSense from my website using jQuery. I was reading the policies on AdSense and I'm a little confused. On the page regarding the Modification of the AdSense ad code, it states:

Hiding ad units at anytime (e.g., display:none), unless you're implementing a responsive ad unit

I am using the responsive ad unit. The problem though is that if the page is opened in the mobile view but is then resized to a bigger size, the ad stays the size as it was in the mobile view (causing it to cover other elements such as links). The only foreseeable way (I can see) of doing this is by removing the ad if the window is resized. The only examples I can find use CSS.

Would setting display: none on the AdSense element using jQuery be a violation of the Google AdSense policy?

  • This is an important question. I do not know the answer. But it makes me think about my site and whether I am doing things right. I may not be. Cheers!!
    – closetnoc
    Commented Feb 23, 2016 at 3:29
  • You can hide it with @media queries in CSS3 for desired resolutions, I am not sure if it will violate AdSence policy, you have to read about it, also I recommend css because it is parsed before js when your page loads and it's really well supported.
    – knif3r
    Commented Feb 23, 2016 at 8:43

1 Answer 1


I'm not sure what device you're using, but I can offer a suggestion that works in usability.

I run a mobile site as well but I don't use responsive ad units. Instead, I use a large fixed Adsense ad unit inside a floated box. That way, text neatly wraps around it. I even change screen resolution on my old flip phone when I tried this and the ad still stays in place.

What I could suggest if you're using a responsive ad unit is to pick the maximum size you want to use for it and set that as the size of your box and make it float. You will need CSS, and this method will not require display: none.

display:none will likely count as a violation if you load the ad in the background and you use display:none to make it so the ad never appears on the screen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.