Can you confirm my understanding of HTML5's <script async>
attribute?
- Any libraries referenced by other code in the page should not specify the async attribute.
For example, my script references might appropriately look like:
<script src="jquery..." /> <!-- async not used - ensure that this is loaded before JQuery UI and my code -->
<script src="jquery.ui..." /> <!-- async not used - ensure that this is loaded before my code -->
<script src="my_code1.js" async /> <!-- async used, for page load performance -->
<script src="my_code2.js" async /> <!-- async used, for page load performance -->
- For any code in a
$(document).ready(function () { }
block, I can be assured that all async script have already loaded.
Do I have this right?
Source: Tips4all
No comments:
Post a Comment