Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A simple, robust way would be a timer. Given the vagaries of unknown ad loading time -- and whether it loads at all -- it won't be perfect. But it's a lot simpler than trying to determine when or if the ad loads.</p> <p>Try something like:</p> <pre><code>function loadImageBG (id) { setTimeout ( function () { document.getElementById (id).style.backgroundImage = resources[id]; }, 888); } </code></pre> <p><br> I recommend not trying to stop the cache; you don't want to annoy your users <em>too</em> much. ;)</p> <p>But, one way to do that is to append unique parameters to the resource URL:</p> <pre><code>function loadImageBG (id) { setTimeout ( function () { var d = new Date(); var milliSecs = d.getTime(); var noCacheURL = resources[id].replace (/'\)/, "?nc=" + milliSecs + "')"); document.getElementById (id).style.backgroundImage = noCacheURL; }, 888); } </code></pre> <hr> <p>Notes:</p> <ol> <li><p><code>888</code> is the timer delay in milliseconds. For usability reasons, I recommend not making this larger than <code>1000</code> -- which is 1 second.</p></li> <li><p>There is no <code>noCacheURL</code> delay value. Because <code>noCacheURL</code>s value is set by the millisecond clock, it's value will always be different with every page load.</p> <p>Thus, the user's browser will always request a fresh copy, bypassing the user's cache.</p> <p>If you are using a dynamically generated image (seems doubtful) and caching <em>that</em> server-side, then its timeout is a different question that you would need to ask separately.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload