S
S
Sergey2013-01-19 14:37:56
JavaScript
Sergey, 2013-01-19 14:37:56

Script loading order, asynchronous loading?

Actually, there was a problem on one project that I had not encountered before. After the cache was screwed on one rather heavy project, the page generation time decreased by 2 times. That would seem to be all, but now another problem.
All project scripts depend on jQuery, which is connected from the CDN. Also, all scripts (including jQuery with a falback for local loading) are placed at the end of the page body. After the optimizations on the server, the situation began to be observed that the project scripts are processed before jQuery is loaded, since they are loaded earlier.
Tie everything to AMD / LMD is of course the way out, but I'm just curious to know the reasons for this behavior, and more importantly, how to deal with it.
I don't really want to put the jQuery connection in the head section of the page.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EugeneOZ, 2013-01-19
Protko @Fesor

Not quite in the topic of the article itself, but there is an answer to your question: blog.ircmaxell.com/2013/01/promise-for-clean-code.html

O
osypchuk, 2013-01-19
@osypchuk

We insert the scripts into the dom manually after rendering the page. It has a very beneficial effect on rendering speed from the user's point of view.
1) jquery
2) other scripts
3) inline scripts
We wait for each script to load and only then proceed to the next step.
see http://abo.ua

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question