0

I use async attribute with the simplest way :
<script async type="text/javascript" src="path/jquery-1.10.2.min.js"></script>
for all .js in my page but problem is that once it loads good and once no.
Especially when i refresh page .js scripts doesn't load.
As soon as i delete async, everything works fine but it is no solution.
Someone know, where problem could be ?
Thanks

1
  • The script still loads, it just most likely loads after you need it to load (dependent scripts like jQuery plugins) end up loading before jQuery is available. Commented Apr 20, 2015 at 12:29

1 Answer 1

1

From the spec:

If the async attribute is present, then the script will be executed asynchronously, as soon as it is available.

That means that, depending on how fast the browser manages to download it, it might be executed before or after the other scripts you have that depend on it.

Don't use async when you are loading a script that other scripts will depend on.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.