Window "load" event not firing on Android

Viewed 16

I've got some code that's working perfectly on all other devices but Andrdoid. I need to call a function when the window is done loading, so I'm using the following code:

if(window.addEventListener){
    console.log('adding event listener!');
    // ^^^ this fires
    window.addEventListener('load', startVidTracker, false);
    // ^^^ this NEVER fires on Android
} else if(window.attachEvent){
    window.attachEvent('onload', startVidTracker);
} else {
    window.onload = startVidTracker;
}

I'm currently testing on a OnePlus 10 Pro and using remote debugging. Is there any workaround for this issue?

0 Answers
Related