we have javascript code that injects elements into the DOM. Therefore it needs to wait until the DOM is in the required state.
We use the following for this:
document.onreadystatechange = function () {
if (document.readyState === "interactive") {
if (!tagsPlaced)
placeTags();
}
};
var DOMReady = function(a,b,c){b=document,c='addEventListener';b[c]?b[c]('DOMContentLoaded',a):window.attachEvent('onload',a);};
DOMReady(function () {
if (!tagsPlaced)
placeTags();
});
When there is a site with a slow or not loading script, it never fires these events..
The site is fully useable from the user perspective, and if we call "placeTags" manually it works as well.
One solution would be to call "placeTags" from the footer of the page. Unfortunately, we need to support loading the javascript anywhere on the page.
What can be done?