Return to Snippet

Revision: 36589
at November 23, 2010 23:13 by tennison


Initial Code
(function() {
    function async_load(){
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = 'http://yourdomain.com/script.js';
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
    }
    if (window.attachEvent)
        window.attachEvent('onload', async_load);
    else
        window.addEventListener('load', async_load, false);
})();

Initial URL
http://friendlybit.com/js/lazy-loading-asyncronous-javascript/

Initial Description

                                

Initial Title
Async load JS file

Initial Tags

                                

Initial Language
JavaScript