Forum Moderators: martinibuster

Message Too Old, No Replies

How to check by javascript, are the ads loaded

After this, some luxury can start

         

jetteroheller

5:35 pm on Aug 29, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just found, device pixel ratio 1 is a minority.
Just thought, on devices with dpr > 1,
I could exchange images with higher resolution images.

Just tested it with my logo in higher resolution. Looks on my smartphone really much better.

But this is pure luxury for improving a little bit.
So I thought to start with this only when the ads are already loaded.

But how to check, are the ads loaded?

keyplyr

8:10 pm on Aug 29, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use a JS getElementById but you need to delay it until the after DFP finishes loadingeither at the end of the page or maybe on a window.onload. Also, IE handles this a bit differently so you'll need to consider a work-around.

Sorry I don't have any code examples, but there are a few if you web search.