Skip to content

Instantly share code, notes, and snippets.

View eshrinivasan's full-sized avatar
🏠
Working from home

Neelmeg eshrinivasan

🏠
Working from home
View GitHub Profile
@isaacs
isaacs / gist:157681
Created July 28, 2009 21:30
Javascript loading example
<!DOCTYPE html>
<html>
<head>
<script>function L(B,D){var A=document.createElement("script"),C=document.documentElement.firstChild;A.type="text/javascript";if(A.readyState){A.onreadystatechange=function(){if(A.readyState=="loaded"||A.readyState=="complete"){A.onreadystatechange=null;D()}}}else{A.onload=function(){D()}}A.src=B;C.insertBefore(A,C.firstChild)};
// async loading of javascript files, starting asap.
L("http://example.com/example.js",function () {
doSomething();
});
L("http://example.com/foo.js", function () {