Welcome to WebmasterWorld Guest from 18.205.176.85

Forum Moderators: martinibuster

Message Too Old, No Replies

How to check by javascript, are the ads loaded

After this, some luxury can start

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

Senior Member

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 22, 2005
posts: 3062
votes: 6


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?
8:10 pm on Aug 29, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 893


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.