Skip to content

Instantly share code, notes, and snippets.

@roshanca
Created December 10, 2012 14:49
Show Gist options
  • Save roshanca/4250966 to your computer and use it in GitHub Desktop.
Save roshanca/4250966 to your computer and use it in GitHub Desktop.
异步加载脚本的基本代码
(function (d, s, f) {
s = d.createElement('script');
s.async = 'async';
s.src = 'path/to/file.js';
f = d.getElementsByTagName('script')[0];
f ? f.parentNode.insertBefore(s, f) : d.body.appendChild(s);
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment