Skip to content

Instantly share code, notes, and snippets.

@ryan5500
Created July 11, 2016 08:26
Show Gist options
  • Save ryan5500/98cc0847e1605b0acb67743346d3a963 to your computer and use it in GitHub Desktop.
Save ryan5500/98cc0847e1605b0acb67743346d3a963 to your computer and use it in GitHub Desktop.
サードパーティJavaScriptでの古いブラウザ用のタグ埋め込み方法
<!-- HTML5対応しているブラウザならこれで良い。IEは10以降 -->
<script async src="http://somedomain.com/widget.js"></script>
<script>
(function() {
var script = document.createElement('script');
script.src = 'http://somedomain.com/widget.js';
script.async = true;
var entry = document.getElementByTagName('script')[0];
entry.parentNode.insertBefore(script, entry);
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment