How to add a script to a web page

A few things on the world of the Internet require some programming code to control and send information to the website's system. Among these things, we usually include search engines, forms and other similar contents.

The best way to add the scripts you are willing to use is saving them under separate files. Thus, for a script "A" written in Javascript, the best thing to do is to create a file "a.js" and include all the code there, so that you can only summon that file when you needed on the final page.

There are two advantages of using this method. The first one is that you will not have to change your files one by one if you ever need to change the script. The second one is that your website will consume less server resources and help you have a better performance.

Use this line of code to summon your script, either if you need it on the <head></head> or <body></body> section of your web page.

<script type="" src=""></script>

You only need to specify the type of script you are going to use (e.g. text/javascript) and its source file (e.g. a.js).

That's all.

Click here to continue.


Creative Commons Heptagrama, the web summed up.
Some rights reserved.

Discover and learn + Computers and the Internet

Sure you don't want to advertise here?

Enviar / Send