Integrating JavaScript resources in HTML: what's the best way?

I am working on a project that uses many scripts (Google Maps, jQuery, jQuery plugins, jQuery UI ...). Some pages have nearly 350 KB of Javascript.

We are concerned about performance, and I ask myself what is the best way to integrate these difficult scenarios.

We have 2 solutions:

  • Include all scripts in your head, even if they are not used on the page.
  • Turn on some common scripts in your head and include special pages when they are needed.

I would like your advice.

Thank.

+3
source share
4 answers

javascript ( , YUI), . - googles.

, javascript , - .

javascript . javascript, , .

, AJAX javascript framework, html, css javascript ( 3- ) javascript.

+2

, JavaScript Google Maps, . , - ( Google CDN ).

+1

<head> ( ), , , <body>.

, , , .

Id , 350 JavaScript, . , gzipped? jQuery 1.4 19 - gzipped.

0

1) , jquery .. , , Google. u

2) , , , , , , , yslow

3) , ,

4) , css, , .

0

Source: https://habr.com/ru/post/1733166/


All Articles