0

What is the correct term for using this syntax for including external javascript file:

<script src="script.js"></script>

Is the script.js included? Is it executed? Is it linked? Is it called? Did I just run the file?

2
  • w3.org/TR/html5/scripting-1.html#scripting-1 Commented Nov 2, 2014 at 4:35
  • I think it is an included linked script, wich is called then executed. And yes, if you include this in your html and the link is correct, then you just ran it ; congrats! Commented Nov 2, 2014 at 4:36

2 Answers 2

3

I think the most common term around here is loading an external Javascript file. For instance, if someone is trying to use jQuery, and they keep getting errors saying that $ is not defined, the answer will often be that they forgot to load jquery.min.js before the script that uses it.

Sign up to request clarification or add additional context in comments.

Comments

1

When the script tag is encountered, a request is sent to the server to provide the script.

In the meantime, modern browsers will continue to scan the document for additional content to download. However, the rendering is still blocked until that script is done.

After the script has been downloaded it is executed before any subsequent1 script that may or may not have finished downloading before him2. Note that there are exceptions to this rule (read about async loading of scripts).

Now, to answer your question: I usually use the term include as in "It is recommended that we include our js files at the bottom of the page since the page rendering will be blocked until they are downloaded and executed". Some people call it script loading. For me, it doesn't really matter as long as you understand the process.

Read more here.

1 a script included after him in the page structure
2 this can happen since the modern browsers download scripts in parallel

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.