Jump to content

How to refresh async javascript tags


Josh

Recommended Posts

Usage example for refreshing javascript async invocation tags.

Got it working like so

HTML

    <div class="ad-300x250" id="ad-300x250-1">
        <ins data-revive-zoneid="153" data-revive-id="b7c2bd3ff3b3bed3a9daa932a43cc2a8"></ins>
        <script async src="https://ra.example.com/www/delivery/asyncjs.php"></script>
    </div>

    <div class="ad-300x250" id="ad-300x250-2">
        <ins data-revive-zoneid="154" data-revive-id="b7c2bd3ff3b3bed3a9daa932a43cc2a8"></ins>
        <script async src="https://ra.example.com/www/delivery/asyncjs.php"></script>
    </div>

JS

    // placements to refresh
    var adSlots = ['#ad-300x250-1', '#ad-300x250-2'];

    // remove data-revive-loaded attribute
    for (var i = adSlots.length - 1; i >= 0; i--) {
        $(adSlots).find('ins').removeAttr('data-revive-loaded');
    }

    // refresh the ads (use your data-revive-id)
    reviveAsync.b7c2bd3ff3b3bed3a9daa932a43cc2a8.refresh();

    // if your data-revive-id starts with number, access like so
    //reviveAsync['7bc2bd3ff3b3bed3a9daa932a43cc2a8'].refresh();

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
On 5/31/2019 at 1:33 PM, Nidhi said:

What is reviveAsync?

I got this error reviveAsync is not defined

reviveAsync" is window.reviveAsync .

replace: 

On 12/4/2017 at 11:05 PM, Josh said:

    // refresh the ads (use your data-revive-id)
    reviveAsync.b7c2bd3ff3b3bed3a9daa932a43cc2a8.refresh();

    // if your data-revive-id starts with number, access like so
    //reviveAsync['7bc2bd3ff3b3bed3a9daa932a43cc2a8'].refresh();

by

// refresh the ads (use your data-revive-id)
window.reviveAsync.b7c2bd3ff3b3bed3a9daa932a43cc2a8.refresh();

// if your data-revive-id starts with number, access like so
//
window.reviveAsync['7bc2bd3ff3b3bed3a9daa932a43cc2a8'].refresh();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...