Nested document.write()
script1A.js
loads script1B.js
using document.write()
, and script2A.js
loads script2B.js
in the same way. This demo uses iframed.js to load each first script asynchronously.
Sample
Codes
<div id="widget1"></div>
<div id="widget2"></div>
...
<script src="iframed.min.js"></script>
<script>
createIframe('widget1', 'script1A.js', 'width:100%; height:0');
createIframe('widget2', 'script2A.js', 'width:100%; height:0');
</script>