HieuLsw / mraid-web-tester

Automatically exported from code.google.com/p/mraid-web-tester
0 stars 0 forks source link

MRAID object not available fast enough #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Originally reported by Adam Schuetz <adam at admarvel.com>on Mar 1, 2013

Web tester doesn't load MRAID as fast as expected.  So instead of doing this 
(which is show in MRAID document):

    function doReadyCheck()
    {   
        if (mraid.getState() == 'loading') 
        {   
            mraid.addEventListener("ready", showMyAd);  
        } 
        else
        {   
            showMyAd();      
        }
    }

    doReadyCheck();

We have to do:

    function doReadyCheck()
    {
        if (typeof(mraid) === 'undefined')
        {
            setTimeout(doReadyCheck, 250);
        }
        else
        {
            if (mraid.getState() == 'loading') 
            {
                mraid.addEventListener("ready", showMyAd);  
            } 
            else
            {
                showMyAd();      
            }
        }
    }   

    doReadyCheck();

Original issue reported on code.google.com by nathan.c...@crispmedia.com on 21 Oct 2013 at 10:15

GoogleCodeExporter commented 9 years ago
Frank,

I think this is related to the issue you are fixing. Can you confirm that your 
efforts can address this too?

Thanks,
-Nathan

Original comment by nathan.c...@crispmedia.com on 21 Oct 2013 at 10:16

GoogleCodeExporter commented 9 years ago
Sample ads from Adam attached.

Original comment by nathan.c...@crispmedia.com on 21 Oct 2013 at 10:32

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, this is precisely the same issue I'm trying to address.

Original comment by frank.sh...@crispmedia.com on 22 Oct 2013 at 1:32

GoogleCodeExporter commented 9 years ago
updated mraidview.js:

created a new function, loadHtml(), that is called once we know that mraid is 
available. This function loads the ad html into the iframe document and then 
cycles through any scripts (in adhtml), appending them to the body as needed. 
This functionality used to be in loadAd(), but would often fire before mraid 
was available, and so the ad would not display.

Original comment by frank.sh...@crispmedia.com on 23 Oct 2013 at 8:39