Client-side scripting and server-side scripting

From Computer Science Wiki
Web Science[1]

Client-side Environment

The client-side environment used to run scripts is usually a browser. The processing takes place on the end users computer. The source code is transferred from the web server to the users computer over the internet and run directly in the browser.[2]

The scripting language needs to be enabled on the client computer. Sometimes if a user is conscious of security risks they may switch the scripting facility off. When this is the case a message usually pops up to alert the user when script is attempting to run.

Server-side Environment

A server is a computer system that serves as a central repository of data and programs and is shared by clients[3]

The server-side environment that runs a scripting language is a web server. A user's request is fulfilled by running a script directly on the web server to generate dynamic HTML pages. This HTML is then sent to the client browser. It is usually used to provide interactive web sites that interface to databases or other data stores on the server.

This is different from client-side scripting where scripts are run by the viewing web browser, usually in JavaScript. The primary advantage to server-side scripting is the ability to highly customize the response based on the user's requirements, access rights, or queries into data stores.[4]

More information to help you evaluate[edit]

I use this material with tremendous gratitude from stack exchange[5]
Background

Web development is all about communication. In this case, communication between two (2) parties, over the HTTP protocol:

  • The Server - This party is responsible for serving pages.
  • The Client - This party requests pages from the Server, and displays them to the user. In most cases, the client is a web browser.
  • The User - The user uses the Client in order to surf the web, fill in forms, watch videos online, etc.
  • Each side's programming, refers to code which runs at the specific machine, the server's or the client's.

Basic Example

  1. The User opens his web browser (the Client).
  2. The User browses to http://google.com.
  3. The Client (on the behalf of the User), sends a request to http://google.com (the Server), for their home page.
  4. The Server then acknowledges the request, and replies the client with some meta-data (called headers), followed by the page's source.
  5. The Client then receives the page's source, and renders it into a human viewable website.
  6. The User types Stack Overflow into the search bar, and presses Enter
  7. The Client submits that data to the Server.
  8. The Server processes that data, and replies with a page matching the search results.
  9. The Client, once again, renders that page for the User to view.

Server-side Programming[edit]

Server-side programming, is the general name for the kinds of programs which are run on the Server.

Uses:

  1. Process user input.
  2. Display pages.
  3. Structure web applications.
  4. Interact with permanent storage (SQL, files).

Example Languages:

  1. PHP
  2. Python
  3. ASP.Net in C#, C++, or Visual Basic.
  4. Nearly any language (C++, C#, Java). These were not designed specifically for the task, but are now often used for application-level web services.

Client-side programming[edit]

Much like the server-side, Client-side programming is the name for all of the programs which are run on the Client.

Uses:

  1. Make interactive webpages.
  2. Make stuff happen dynamically on the web page.
  3. Interact with temporary storage, and local storage (Cookies, localStorage).
  4. Send requests to the server, and retrieve data from it.
  5. Provide a remote service for client-side applications, such as software registration, content delivery, or remote multi-player gaming.

Example languages:

  1. JavaScript (primarily)
  2. HTML*
  3. CSS*
  4. Any language running on a client device that interacts with a remote service is a client-side language.
  • HTML and CSS aren't really "programming languages" per-se. They are markup syntax by which the Client renders the page for the User.

Do you understand this?[edit]

Evaluate the use of client-side scripting and server-side scripting in web pages.

Standards[edit]

These standards are used from the IB Computer Science Subject Guide[6]

  • Evaluate the use of client-side scripting and server-side scripting in web pages.

References[edit]