scripting languages client side and server side. examples of client side/server side examples of...
TRANSCRIPT
Scripting Languages
Client Side and Server Side
Examples of client side/server sideExamples of client-side side include:• JavaScript• Jquery (uses a JavaScript library containing very easy to use,
condensed functions and syntax - http://jquery.com/download/ )• VBScript (simplified version of Visual Basic)• ActionScript (used in Flash animation/web pages)
Examples of server-side include:• PHP (.php)• ASP (.asp)• JSP (.jsp), • ASP.NET (.NET) (.aspx), • COLDFUSION (.cfm)• RUBY (.rb) RUBY ON RAILS (.rbw) • PERL (.cgi, .pl, .ipl)• PYTHON (.py)
Scripting languages require a web server to run, e.g. Apache and IIS. Check the server is capable of running the server-side scripting language
Advantages/disadvantages of Client Side ScriptsClient sideADVANTAGES• Takes load off server (processing done at client end – quicker –
uses less bandwidth)• Can be used for non essential functions (e.g. navigation, pop ups,
rollovers, form validation, etc.)• Easy to use – only text editor and a browser required. No testing
software needed• Makes web pages more interactive
DISADVANTAGES• Malicious executable code downloaded from a remote server to a
web browser's machine, could be installed and run allowing access to data, to install a virus, etc.
• Different layout engines (browsers/platforms) may render JavaScript differently resulting in inconsistency in terms of functionality and interface.
• The user can turn settings for JavaScript off in their browser
Advantages/disadvantages of Server Side ScriptsClient sideADVANTAGES• Can be used for security essential functions (e.g. login screens,
form validation)• Relatively easy to use – require a server to run and editor to write
scripts• Script is parsed or interpreted at the server end, and sends the
web page to the web browser as HTML (user cannot see the server script)
• Makes web pages more interactive• Can access databases and create dynamic web pages
DISADVANTAGES• Can put more load on server (requires bandwidth, may be sharing
server with other websites, may cause delay in web page being sent to browser)
• Different layout engines (browsers/platforms) may render script differently resulting in inconsistency in terms of functionality and interface.
Implementing Client-side ScriptsClient-side JavaScript code can be embedded within HTML documents in a number of ways:• Between a pair of script tags <SCRIPT></SCRIPT>• From an external file specified by the src attribute of a script tag,
e.g.
<script TYPE="text/javascript" src="validate.js"></script>• In an event handler, specified as the value of an HTML attribute
such as onclick, onsubmit or onmouseover, e.g.
<form id="form1" action="validate.js" onSubmit="validateForm()">
• In an URL that uses the special javascript:// protocol
JavaScript Example - Date<html><head> <title>Today's Date</title>
<script language="JavaScript"> function date( ) {
var d = new Date( ); // Create a date object storing today's date and time document.write(d.toLocaleString( )); // Write the value of the date object to the document
} </script>
</head> <body> <p>The date and time are <script language="JavaScript">date( ); </script> </html>
Links• http://www.jscripters.com/javascript-advantages-and-disadvantage
s/
• www.w3schools.com • www.apache.org/