On the Internet, there seems to be a general conclusion that external js files are better.
The main reasons are caching, maintenance, and debugging.
However, there doesn't seem to be much discussion of the overhead of 304 HTTP requests. I went to yahoo.com and noticed that 304 for each javascript file has an overhead of about 30 ms per file (mainly related to connecting and responding).
I have separate javascript files (solution to a maintenance problem). I don't really need debugging (automated tests are very useful).
I am considering whether to pack and embed them in a single script tag on top of an html document. I know there is a point at which this makes no sense (when my javascript is very large), and I have to check this out.
I'm just wondering if anyone has done any tests on this subject, what results did they get?
I also do not have benchmarks, it also depends on the connection delay. but subjectively, I never felt this delay.
I would recommend to separate the dynamic content (html that you rendered on the server) and static content (css, js). first of all, the payload of your html gets much less (you save server rendering time + payload lower), and, in addition, this is a clear separation and is better served from the point of view of codes.
GET (, Modified-Since Etags), Expires. http-.
, . , 30 , HTML- JS (, javascript -, JS ).
, ? , , , JS , , , ( , , F5 . ).
- , , JavaScript, XML- XHTML+. JS , .
JS , , , JavaScript HTML.
, @getify @zoompf, .
<script>? .js? CSS - ?
<script>
.js
. http://mathiasbynens.be/notes/inline-vs-separate-file .
, 304 .
cache-control: public, max-age = 3600
, . , .
-: max-age = 3600
, , , .
js , . , - http://code.google.com/p/talifun-web/wiki/CrusherModule js etag, md5 . , , .
Source: https://habr.com/ru/post/1748220/More articles:Persist url parameter in grails application - grailshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1748216/jquery-how-to-add-a-class-to-a-td-tag&usg=ALkJrhh-jRTdQEQmxZSB-0qAOBKUXNgrAQUser route does not find controller action - asp.net-mvc-2A tool for determining jar dependencies based on existing code? - javaiPhone: keep text looking good after zooming in? - textGetting selected items from WinForm ListBox? - c #How much time do PHP / Python / Ruby * programmers spend on CSS? - cssDUMP in unhandled C ++ exception - c ++mvvm-light: Should we combine the cleanup methods in the locator? - .net'ORA-01031: insufficient privilege error received while inserting into view - oracleAll Articles