What Are Client-Side Web Scripting Languages?

The term 'Client-Side' refers to the fact that these are languages that process locally inside your browser, as opposed to 'Server-Side' languages that 'run' or process at the web-server (which we covered in our last post).

These are the most frequently used client-side languages in use across modern web browsers (Chrome, FireFox, Internet Explorer, Safari & Opera).

DHTML (Dynamic HyperText Markup Language)

DHTML is not strictly a scripting language - but a collection/grouping of technologies to allow dynamic changing of a web page. It usually includes HTML, CSS & JavaScript.

DHTML is useful in that it allows some clever display affects without having to revert to Adobe Flash; so no extra plug-ins are required - apart from JavaScript being enabled. The vast majority of browsers will therefore successfully display these effects.

It's important to differentiate here that 'dynamic' in this sense still means client-side processing of a page, and not dynamic page creation, which happens server-side via languages such as PHP or ASP.

Nowadays, a 'dynamic' webpage usually means it's utilising PHP or ASP, together with a database connection, to create the page at the server. A good example would be Amazon.com. Amazon has over half a billion pages, but these are not stored as individual web pages; each page is created 'on-the-fly' by a program script that pulls information from a massive database, and then layers it into template pages.

This way, whenever the database is updated (product information, pricing and user-comments for example,) the web page always shows the latest information. It would be a virtual impossibility for Amazon to maintain half a billion individual web pages as static HTML - and incredibly inefficient; not to mention the fact that it would remove most of the social/feedback/interactive elements of the site.

Java

Java was originally designed as a platform-independent programming language to be used in consumer electronics, and has a number of features which make it particularly useful for the web.

Unlike most full programming languages, Java is not compiled into a platform-dependent machine code executable file, but is instead compiled into a special platform-independent Java executable - which is interpreted by a local Java runtime environment. It is essentially the responsibility of the user to have a JRE (Java Run-time Environment) installed so that they may use the Java application.

Side-Note: Java is now owned by Oracle after being purchased from Sun Microsystems in 2009. It is believed that Oracle purchased Sun and Java as more of a strategic move, so that they could own the environment in which much of their software is written, and become more of an integrated supplier of hardware and systems. Oracle also own MySQL.

Java 'web-applets' are getting rarer these days, as many of the results can be achieved by other 'more integrated' scripting and programming languages that don't require their own installed environment. Many users won't have Java installed on their systems; can you remember the last time you actually needed Java installed? The only time we've needed it in the last few years is to run the 'Wordle' application! (See http://www.wordle.net ) We only really mention Java here so that we can differentiate it from JavaScript.

JavaScript

JavaScript, contrary to popular opinion, is not related to Java - and was originally developed for Netscape's Navigator browser. It's a client-side scripting language, generally embedded into HTML pages via the <script> tag, which can provide some fairly clever interactivity and real-time control of web and page elements – including layout. JavaScript is also easier to learn and get to grips with than a full programming language.

Some development environments, such as Adobe Dreamweaver, have a bunch of standard JavaScript 'behaviours' which they can embed into HTML to produce some special effects. There are also many free resources on the Internet to download JavaScript scripts to add into your web pages. It should be noted that with HTML5 and CSS3, many of the visual effects that used to require JavaScript can now be accomplished without it.

Any web page that uses JavaScript can be freely looked at by viewing the page source-code from your browser (CTRL-U in Chrome, Firefox & IE). While it's definitely not okay to steal other people's code, it's always worth checking things out – as you can learn a lot by looking at what others have done.

Remember that JavaScript needs to be supported by the browser and also needs to be enabled (but it is enabled by default in all modern browsers). Whilst it could be said that 5-10 years ago, it wouldn’t have been wise to create a site that required JavaScript to function, nowadays it’s par for the course; what with the move to HTML5, CSS3 & interactive social-media elements. You wouldn’t be able to use the majority of modern social sites without JavaScript running, so it seems fair to assume that the majority of users will have to be running it.

AJAX (Asynchronous JavaScript & XML)

Ajax allows a client-side JavaScript application to communicate with a server-side database like MySQL in real-time. This means that browser-embedded Ajax applications have the feel of 'desktop' applications, because the browser does not need to perform a page refresh (F5) to update.

This is enormously powerful, especially for social-media/interactive site elements where instant feedback is required. If you picture the last time you used Twitter, and remember how tweets can stream-in live and change on-screen, this is JavaScript in action. Now, if you imagine those real-time updates coming in from other users around the world, you're seeing Ajax in action.

In many ways, Ajax has opened the door to a whole new world of exciting possibilities. Because of this, Ajax is becoming more and more prevalent on websites, as fast dynamic data look-up becomes vital to socially-driven sites. And the really big advantage is that the vast majority of browsers will support it as standard – without extra plugins like Adobe Flash etc.

VBScript (Visual Basic Script)

Like JavaScript, VBScript is a client-side scripting language and is embedded in the HTML file. Unlike JavaScript, VBScript only runs from within Microsoft Internet Explorer, giving it a limited value. Bear in mind that only 3.5% of the world's internet users are browsing through IE; this would therefore mean that you'd automatically alienated over 95% of your possible visitors!

VBScript is based on Microsoft's Visual Basic programming language, although it is simpler to use. VBScript is also the standard default language for ASP.NET (Active Server Pages) - and this remains its main use today; as this is server-side, rather than client-side.