For a couple of years now that a different philosophy have emerged.
There are just too many machines and operating systems.
Nowadays a lot of designers believe that the only difference between
mobile machines and desktop machines (and later also tables) is the width
of the screen.
HTML pages that have a viewport with "width=device-width" retain the relation between pixel and a physical measure like an inch. This means that a pixel SHOULD be measured almost the same when using a mobile machine or a desktop one. This means that a 300px over 300px div in a mobile machine should look almost the same as it would on a desktop machine.
This also means that the window width in pixel gets lower as the screen is smaller physically.
Making a long story short, you can use a window width cutoff of 768px to distinguish between mobile and desktop apps.
CSS is obviously preferred in terms of performance over javascript code that
shows and hides stuff according to the window width.
// desktop css
.ad {
display: block;
}
@media screen and (max-width: 768px) {
// mobile css
.ad {
display:none;
}
}