3rd party's JavaScript asynchronous loading

Iframed pattern (friendly iframe)

Load script asynchronously using friendly iframe. In this demo, the script (it has some document.write() inside of it) will be loaded after onload fired (lazy loading). This leads the busy indicator of the browser does not work so busy.

Sample

Codes

<div id="gist" style="overflow: auto;"></div>
...
<script src="iframed.min.js"></script>
<script>
    lazyLoadIframe('gist', 'https://gist.github.com/...', 'width:98%; height:0', '400px', 'style.css');
</script>