Would it be better to enable () resources (css, js) or let the browser execute another request?

Will it be faster to include a javascript file and output it in html how <script>or just use the attribute srcand let the browser make another request?

Just outputting it instead of letting the browser make another request would clearly mean fewer requests and possibly less server load, but does it make it faster? The inclusion of files and their output do not allow the browser to cache them.

+3
source share
3 answers

If you enable it, every other page will have the overhead of downloading the script again.

( ), . , , , JavaScript.

, JavaScript. , , , , HTTP- .

99% , , - .

+5

. , .

: , .

: js, , , . cdn, .

( http)

, js ,

, javascript ( javascript , , javascript dom ).

, script , , -

, , : http://developer.yahoo.com/performance/rules.html

+2

I agree with @alex. In addition, the binding allows you to load script files in parallel when analyzing the page. Most browsers use multiple streams to load content when analyzing the contents of the main page.

0
source

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


All Articles