当前位置: 动力学知识库 > 问答 > 编程问答 >

performance - Are these the same? ASYNC Javascript

问题描述:

<script type="text/javascript">

(function() {

var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;

po.src = "https://apis.google.com/js/plusone.js?publisherid=112917099095075652323";

var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);

})();

</script>

<script async src="https://apis.google.com/js/plusone.js?publisherid=112917099095075652323"></script>

Id like to start switching over scripts that are loaded from third parties into the latter syntax. Curious as if the type attribute is even needed. Looking to load all these scripts asynchronously. Thoughts?

网友答案:

In your first part of codes, you are actually just creating the same HTTP tag. I think it should be checkable by Chrome or FireFox F12 since the codes there (Chrome F12 - Elements) are processed.

分享给朋友:
您可能感兴趣的文章:
随机阅读: