Client Side Scripting ?

  KW2K 23:02 14 Dec 2004

Hi, Can someone explain what Client side scripting is, and, what are the advantages of using it. Maybe even give some examples !


  Taran 01:26 15 Dec 2004

Scripts can run either on the Web server (server-side scripting) or on the user's computer (client-side scripting) so a client-side cript is one that is processed on your computer.

Server-side scripts are normally used for dynamic interaction with the website visitor. The visitor may input information which is passed around different pages of a web site - a shopping cart for online trading is a good example of server-side scripting.

Client-side scripting is most often written using JavaScript. You can also use VBScript and one or two others. Basically, any script that is embedded into the HTML that makes up the web page and is processed by your browser when you view the page is a client-side script.

JavaScript is an object-oriented scripting language. When used for client-side scripting the JavaScript is part of the HTML document and it runs inside a Web browser. It manipulates elements on a Web page by means of a Document Object Model, or DOM. A DOM is an API for interacting with a Web page. An API is an Application Program Interface, or a way of gaining access to a program to get it to do things that yuo want it to do.

Here is a very simple example of a JavaScript snippet embedded into an HTML web page:



<title>Hello World JavaScript Example</title>



<script language="JavaScript">

document.write("Hello World!");




When a site visitor reqests that page, it 'runs' the JavaScript program in their web browser and outputs the results onto the page being viewed. In the above example, the JavaScript program says Hello World!

Complex JavaScript often trips web browsers up when some of them try to read and run it, and anything processed by the web browser as client-side code cannot be considered very secure since anyone can view the source of the page. Because of this, it would be a poor choice for usernames abnd passwords although ,having said that, there are ways and means of using it for this but we go into encryption and all kinds of other junk.

There you go.

  Forum Editor 01:26 15 Dec 2004

and there isn't the time or the space to provide you with more than an overview here. For what it's worth however, here goes:

Client side scripting is used to provide a web designer with a greater versatility when it comes to making a page more interesting and interactive without increasing the load on a web server. They make the user's computer do some of the work. Server side scripts run in the web server and client side scripts run in the browser on a visitor's computer. Various scripting languages (such as JavaScript, JScript and VisualBasic) can be used, but the visitor's browser must be capable of understanding whichever technology a particular site designer has employed, and straight away you can see what the main problem is. If a particular browser can't understand that scripting language then people who use that browser may not be able to use the site properly.

An example of a client side script might be an e-commerce site form that is submitted using Javascript. The client side script is used to validate the form's information before it is sent to the server. In most cases the data would then be validated by a a server-side script before it is stored or sent somewhere else for processing. If your site visitors have Javascript disabled in their browser (for security reasons) they wouldn't be able to submit the form, and you'll lose a potential customer.

A further problem is that many people have an innate mistrust of scripts running in their browser, and they disable the facility. This means that they won't be able to use thos parts of a site with client side scripts at all.

So, you can see that whilst client-side scripts can be very useful to web developers in terms of reducing server loads they can be a major disadvantage too. If a visitor's browser can't use the particular script employed that person will miss out, and may not come back. For that reason alone I advise caution, and on my own site development projects I try to stick to server-side scripts.

  Forum Editor 01:28 15 Dec 2004

equals two responses arriving together!

  KW2K 21:18 15 Dec 2004

Thanks Once Again Guy's, as always, advice much appreciated.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Xiaomi Mi Mix 2 review

See mcbess's iconic style animated for Mercedes-Benz

iPhone X news: Release date, price, new features & specs

Black Friday 2017 : date, sites participants & bonnes affaires