Cache script syn or asyn?

I’ve a doubt
First of all I know that’s the asyn way no freeze the browser :slight_smile:
what’s the best way for include script in a page
for caching purpose syn or asyn ?

<script src="//"></script>


    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement('script'); = id;js.async = true;
    js.src = '//';
    ref.parentNode.insertBefore(js, ref);

I think it’s quite irrelevant but …
Thanks in advance

The async attribute instructs browsers that understand it to proceed downloading the rest of the page and scripts while it’s loading that script.
It looks to have pretty complete support these days.

I think you can always add it safely if the scripts aren’t dependent on one another.
I don’t believe there’s a difference between adding the async attribute to a tag or adding the script dynamically like in your example.

I’ve never bothered worrying about micro optimisations like these.
My scripts are always 1 or two scripts at the bottom so there’s little need to download other things asynchronously.

<script src="my-minified-compressed-js.js"></script>
<script src="facebook.js"></script>
<script src="google-analytics.js"></script>