An asynchronously loaded script is likely going to run AFTER the document has been fully parsed and closed. Thus, you can't use document.write()
from such a script (well technically you can, but it won't do what you want).
You will need to replace any document.write()
statements in that script with explicit DOM manipulations by creating the DOM elements and then inserting them into a particular parent with .appendChild()
or .insertBefore()
or setting .innerHTML
or some mechanism for direct DOM manipulation like that.
Read full article from javascript - Execute write on doc: It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened. - Stack Overflow
No comments:
Post a Comment