Web Scipting

The process of creating and embedding scripts in a web page is known as web-page is known as Web-Scripting. A Script or a computer-script is a list of commands that are embedded in a web-page normally and are interpreted and executed by a certain program or scripting engine. Scripts may be written for a variety of purposes such as for automating processes on a local computer or to generate web-pages on the web.

The programming languages in which scripts are written are called scripting languages. There are many scripting languages available today. The Most Common Ones are VBScript, JavaScript, ASP, PHP, PERL, JSP, etc.



Types Of Scripts

Scripts are broadly of the following two types:

1. Client-Side Scripts

Client-Side scripting enables interaction within a web page. The Client-Side scripts are downloaded at the client-end and then interpreted and executed by the browser.
The client-side scripting is browser-dependent. That is, the client-side browser must be scripting enabled in order to run scripts.
Client-Side scripting is used when the client-side interaction is used.

Some sample uses of Client-Side scripting may be :
  • To get data from the user's screen or browser.
  •  Online Games.
  • Customizing the display of the page in the browser without reloading the page e.g., rollover a hyperlink highlights that link without reloading the page.
Some Popular client-side scripting languages are VBScript, JavaScript, Hypertext Preprocessor (PHP).


2. Server-Side Scripts

Server-Side scripting enables the completion or carrying out a task at the server-end and then sending the result to the client-end.
In the server-side script, the server does all the work, so it doesn't matter which browser is being used at the client-end.
Server-side scripting is used when the information is sent to a server to be processed at the server-end.

Some sample uses of server-side scripting may be:
  • Password Protection.
  • Browser Customization (sending information as per the requirements of client-end browser.)
  • Form Processing.
  • Building and displaying pages created from a database.
  • Dynamically editing changing or adding content to a webpage.
Some popular server-side scripting languages are:
PHP (Hypertext PreProcessor), Perl, ASP (Active Server Pages), JSP (Java Server Pages), etc.

Comparing Client-Side and Server-Side Scripting

After discussing the basics of the two types of scripts, in this section, we are going to compare different features and uses of these script types.


Comparing Client-Side and Server-Side Scripting


Client-Side Scripting

1. Script is downloaded and executed at the client-end.
2. Response to interaction is more immediate once the program code has been downloaded.
3. Services are secure as they do not have access to files and databases.
4. Browser dependent
5. Affected by the processing speed of the user's computer.

Server Side Scripting 

1. The Script is executed at the server-end and the result is sent to the client-end.
2. Complex processes are more efficient as the program and associated resources are not downloaded to the browser. 
3. Have access to files and databases but have security consideration when sending sensitive information. 
4. Does not depend on browsers.
5. Affected by the processing speed of the host server.