Skip to content

Instantly share code, notes, and snippets.

View hjerpbakk's full-sized avatar
🌝
Full-stack TypeScript 

Runar Ovesen Hjerpbakk hjerpbakk

🌝
Full-stack TypeScript 
View GitHub Profile
@hjerpbakk
hjerpbakk / snippet.js
Created August 11, 2012 10:07 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts, added js.async=true
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
js.async=true;
id && (js.id = id);
fjs.parentNode.insertBefore(js, fjs);