Insertion of scripts - Introduction
There exist a number of scripting languages that can be called from (or within) HTML files. Basically, this means that you can insert within an HTML page a script which is written in another programming language and which will be either run client-side (i.e. on the machine of your visitors) or server-side (i.e. on the web server hosting your page).
Our goal here will not be to give a detailed explanation of how these scripting languages work but only a short introduction. The interested reader will find greater details about the programming language of his choice on the web.
Insertion of scripts - Client-side scripting languages
Client-side scripting languages such as javascript or vbscript are included within your HTML documents (or saved in indepedent text files and called from your HTML documents) and executed on your visitors' machines: this means that the code of these scripts will be directly and fully interpreted on client machines.
In particular, this implies that the source code of these scripts will be openly readable by your visitors. This is a detail you might want to keep in mind if your intention is to keep your source code confidential (even though there exist ways to obfuscate your code, code obfuscation can always be cracked).
On the other hand, and this is somewhat a compensation for the source code disclosure, you won't need to use up your server's CPU resources in order to run the code every time a visitor needs it - they will do it themselves by using their own computer's processors -.
Another downside of client-side scripting is that you can never be sure that your visitors' computers will be able to support the scripting language that you inserted within your HTML page (nowadays, almost all the browsers support javascript but it happens that it is turned off on certain machines; looking at a website's statistics shows that around 1% of the internet population has javascript turned off on their machines).
Insertion of scripts - Server-side scripting languages
As opposed to client-side scripting languages, server-side scripts run on the server that hosts the webpage containing them; the output is then communicated to your visitor's browser. This has several implications, both in terms of security, efficiency and reach:
- You can keep the source code of your scripts away from the eyes of your visitors, which is important when it comes to dealing with security protocols or safeguarding your copyrights.
- You can rely on your server's CPU to execute the code efficiently, and you can easily and safely access the other resources necessary to its proper execution (for instance mysql databases).
- You do not run the risk that your visitors won't support the scripting language of your scripts.
Examples of such server-side scripting languages are vbscript, python, perl, cgi, php/mysql, ...
A number of scripts can be executed from your HTML pages. We distinguished between client-side scripting and server-side scripting and introduced the advantages and drawbacks of both methods. In the following, we will study the fundamentals of php/mysql, which is currently one of the most flexible and widely used web development solutions.
Next tutorial: Introduction to PHP scripts
Previous tutorial: Meta tags and Search Engine Optimization
Back to computer forums
