//note that i...">

What distinguishes between including and addressing a javascript file

What is the difference

   <!--#include virtual="JS.htm" -->  //note that in this method all JS files imported  like below in JS.htm

and

  <script src="myjavascript.js" type="text/javascript"></script> 
+3
source share
4 answers

In the first case, the javascript file is included on the server side, so it is included in the line. In the second example, the browser loads the html file and then sends another request to the server for the javascript file.

+3
source

<!--#include virtual="JS.htm" --> the server side includes , will not work without certain configurations and is included in the server right there, while the javascript path is loaded on the page.

Server Sphere (SSI) is a simple, interpreted server-side scripting language that is used almost exclusively for the Internet.

SSI - - -. , -, -:

quote.txt, , , . . , , , , , .

, , . .

: WikePedia

+4

#include ASP ASP.NET, . , -, , , , .

javascript, script, . javascript.

+2

( SSI-) js.htm , script , .

While inclusion saves loading time ahead, it does not allow browser caching of javascript, which means that in the end it can be slower.

In general, I would suggest using a script tag, referencing an external file.

+2
source

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


All Articles