Client-side & Server-side Scripting

coordinatedcapableSoftware and s/w Development

Nov 4, 2013 (3 years and 8 months ago)

70 views

Client
-
side & Server
-
side
Scripting


©Richard L. Goldman

August 5, 2003



Requires PowerPoint 2002 or


later for full functionality.

©

Richard L. Goldman

2

Simple HTML Web Page


Simple HTML files are interpreted by the
client’s Web browser, formatted and displayed
as a
static

Web page.


©

Richard L. Goldman

3

Web Server

Client Computer

Simple Web Page

Browser

Software

(IE)

Web

Server

Software

(IIS)

Web Site

Web
Page




(.htm)

Web
Page




(.htm)

Web page

requested

Web server
sends Web
page to
client

Browser
renders
Web page

©

Richard L. Goldman

4

Scripts


Scripts may be included in a Web page to create a
dynamic

Web page which allows user interactivity.


Scripts can be written in different languages:


JavaScript

(IE & Netscape


this is
not

Java)


JScript

(IE only
-

Microsoft version of JavaScript)


VBScript

or
VBS

(IE only
-

Visual Basic)


ECMAScript

(IE & Netscape
-

Cross
-
platform language)


(European Computer Manufacturers Association)


Each scripting language requires its own specific interpreter
(engine) to run the script.

©

Richard L. Goldman

5

Client
-
side Script Tags


Scripts that run on the client’s computer are called Client
-
side scripts.


Use the
<SCRIPT>...</SCRIPT>

tags to include the script in a HTML
document.


Use the
LANGUAGE

attribute to identify the scripting language that you
are using.


<SCRIPT
LANGUAGE=“JavaScript1.3”
>............</SCRIPT>


<SCRIPT
LANGUAGE=“JScript3.0”
>..................</SCRIPT>



<SCRIPT
LANGUAGE=“VBScript1.3”
>...............</SCRIPT>


<SCRIPT
LANGUAGE=“VBS”
>...........................</SCRIPT>



JavaScript is the default language on most browsers and will be run if a
language is not specified.


©

Richard L. Goldman

6

Inserting a Script

<HTML>























</HTML>

<HEAD>






</HEAD>

<BODY>










</BODY>



Scripts can be placed in
either the Head or the
Body.


Client
-
side scripts
placed at the end of the
body will allow the page
to be displayed before
the script is run.

<TITLE>Mr. Goldman</TITLE>

<H2>Welcome</H2>

<P>

<H3><I>Sample</I></H3>

</P>

<SCRIPT LANGUAGE=“JavaScript1.3”>


<document.write “<H1>Hello</H1>”;

</SCRIPT>

<SCRIPT LANGUAGE=“JavaScript1.3”>


<document.write “<H1>Good By</H1>”;

</SCRIPT>

©

Richard L. Goldman

7

Web Server

Client Computer

Client
-
side JavaScript

Browser

Software

(IE)

Web

Server

Software

(IIS)

Web Site

Web page

requested

Web
Page




(.htm)

JavaScript

Web
Page




(.htm)

JavaScript

Server sends
Web page
(with script) to
client

JavaScript

Engine

©

Richard L. Goldman

8

Web Server

Client Computer

Client
-
side JavaScript

Browser

Software

(IE)

Web

Server

Software

(IIS)

Web Site

Browser
renders
Web page

Web
Page




(.htm)

JavaScript

Web
Page




(.htm)

JavaScript

JavaScript

Engine

JavaScript

JavaScript
engine
processes
the script

©

Richard L. Goldman

9

External Client
-
side Scripts


Common scripts that are used by many different
web pages may be placed in an external file.


External JavaScript files must be saved with a
.js

extension.


External files are called with the
source (src)

attribute

of the SCRIPT tag.

<SCRIPT

language=“JavaScript1.3”

src=“myscript.js”
>

©

Richard L. Goldman

10

Web Server

Client Computer

Client
-
side External JavaScript

Browser

Software

(IE)

Web

Server

Software

(IIS)

Web Site

Web page

requested

Web
Page




(.htm)

Script Call

Web
Page




(.htm)

Script Call

Server sends
Web page (with
script call) to
client

ExtScript


(.js)

JavaScript

Engine

©

Richard L. Goldman

11

Web Server

Client Computer

Client
-
side External JavaScript

Browser

Software

(IE)

Web

Server

Software

(IIS)

Web Site

Browser
renders
Web page

Browser calls
external script

Web
Page




(.htm)

Script Call

Web
Page




(.htm)

Script call

ExtScript


(.js)

JavaScript

Engine

Script call

External script
is sent to client
-
side JavaScript
engine

ExtScript


(.js)

©

Richard L. Goldman

12

Client
-
side Script Engines


The client computer can have multiple types of
script engines.


The client computer is capable of running different
types of scripts concurrently.

©

Richard L. Goldman

13

Web Server

Client Computer

Client Side Script Engines

Browser

Software

(IE)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web

Server

Software

(IIS)

ECMAScript

Engine

Web
Page




(.htm)

Web Site

Web
Page




(.htm)

©

Richard L. Goldman

14

Server
-
side Script Software

Manufacturer

Web Server

Server
-
side Language/File Extension

Microsoft

I
nternet
I
nformation
S
erver (
IIS
)

A
ctive
S
erver
P
age /
.asp

Linux/Unix

Apache

P
HP:
H
ypertext
P
rocessor /
.php

Allaire

Cold Fusion

C
old
F
usion
M
arkup language /
.cfm


Server
-
side scripts are designed to be run on a Web
server.


Different manufactures have created different types of
software to implement server
-
side technology


there is no
standard.


The file extension indicates that they are to be processed
by the server and what software should be used.

©

Richard L. Goldman

15

Web Server

Client Computer

Server
-
side VBScript (IIS & ASP)

Browser

Software

(IE)

Web

Server

Software

(IIS)

ASP

Engine

(asp.dll)

VBScript

Engine

Web Site

ASP page

requested

A
ctive

S
erver

P
age



(.asp)

VBScript

A
ctive

S
erver

P
age



(.asp)

VBScript

Web server
sends ASP
page to ASP
Engine

©

Richard L. Goldman

16

Web Server

Client Computer

Server
-
side VBScript

Browser

Software

(IE)

Web

Server

Software

(IIS)

ASP

Engine

(asp.dll)

VBScript

Engine

Web Site

A
ctive

S
erver

P
age



(.asp)

VBScript

A
ctive

S
erver

P
age



(.asp)

A
ctive

S
erver

P
age



(.asp)

VBScript

Browser
renders
Web page

ASP page
(less server
-
side script) is
sent to client

VBScript
engine
processes
the script

©

Richard L. Goldman

17

Web Server

Client Computer

Server
-
side VBScript

Browser

Software

(IE)

Web

Server

Software

(IIS)

ASP

Engine

(asp.dll)

VBScript

Engine

Web Site

A
ctive

S
erver

P
age



(.asp)

VBScript

A
ctive

S
erver

P
age



(.asp)

A
ctive

S
erver

P
age



(.asp)

VBScript

Server
-
side
scripts allow
for interaction
between client
and server.

©

Richard L. Goldman

18

External Server
-
side Scripts


Know as


S
erver
S
ide
I
nclude (SSI) files.


Common scripts that are used by many different server
-
side ASP pages may be placed in a SSI file.


SSI files are saved with an
.inc

extension (or .asp).


SSI files are
called

from an ASP file with the
include

keyword.


SSI files are
located

and
identified

with the
file

attribute.


<!
--
#include
file
=“
/scripts/
head.inc

--
>

©

Richard L. Goldman

19

Web Server

Client Computer

Server Side VBScript

Browser

Software

(IE)

Web

Server

Software

(IIS)

Web
Page




(.htm)

ASP

Engine

(asp.dll)

VBScript

Engine

Web Site

Web Page






(.htm)

SSI file


(.inc)

ASP Page






(.asp)

Script Call

ASP Page






(.asp)

Script Call

ASP page

requested

Web server
sends ASP
page to ASP
Engine

©

Richard L. Goldman

20

Server
-
side Scripts


With server
-
side scripts, the script engine only needs to
be on the Web server


a client
-
side script engine in not
required.


Server
-
side scripts are never sent to the client computer.
The client can not access or view the script.


Client
-
side and server
-
side scripts can be used
concurrently.


Server
-
side scripts can be written in:


JavaScript


JScript


VBScript



(Not ECMAScript)

©

Richard L. Goldman

21

Web Server

Client Computer

Client
-
side & Server
-
side Script Engines

Browser

Software

(IE)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web

Server

Software

(IIS)

ECMAScript

Engine

ASP

Engine

(asp.dll)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web Site

Client
-
side
script engines

Server
-
side script
engines

Web
Page




(.htm)

Web Page






(.htm)

Script Call

CS Script

ASP Page






(.asp)

SS Script

Script Call

©

Richard L. Goldman

22

Web Server

Client Computer

Server Side VBScript

Browser

Software

(IE)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web

Server

Software

(IIS)

ECMAScript

Engine

Web
Page




(.htm)

ASP

Engine

(asp.dll)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Request

Response

Server

Session

Application

Web Site

Web Page






(.htm)

Script Call

CS Script

ASP Page






(.asp)

SS Script

ExtScript


(.js)

SSI file


(.inc)

Script Call

©

Richard L. Goldman

23

Web Server

Client Computer

Server Side VBScript

Browser

Software

(IE)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web

Server

Software

(IIS)

ECMAScript

Engine

Web
Page




(.htm)

ASP

Engine

(asp.dll)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Request

Response

Server

Session

Application

Web Site

Web Page






(.htm)

Script Call

CS Script

ASP Page






(.asp)

SS Script

ExtScript


(.js)

SSI file


(.inc)

Script Call

©

Richard L. Goldman

24

Web Server

Client Computer

Server Side VBScript

Browser

Software

(IE)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web

Server

Software

(IIS)

ECMAScript

Engine

Web
Page




(.htm)

ASP

Engine

(asp.dll)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Request

Response

Server

Session

Application

Web Site

Web Page






(.htm)

Script Call

CS Script

ASP Page






(.asp)

SS Script

ExtScript


(.js)

SSI file


(.inc)

Script Call

©

Richard L. Goldman

25

Web Server

Client Computer

Server Side VBScript

Browser

Software

(IE)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web

Server

Software

(IIS)

A
ctive

S
erver

P
age



(.asp)

ECMAScript

Engine

Web
Page




(.htm)

S
erver

S
ide

I
nclude

file


(.inc)

ASP

Engine

(asp.dll)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Request

Response

Server

Session

Application

Web Site

Web
Page




(.htm)

©

Richard L. Goldman

26

Web Server

Client Computer

Server Side VBScript

Browser

Software

(IE)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Web

Server

Software

(IIS)

A
ctive

S
erver

P
age



(.asp)

ECMAScript

Engine

Web
Page




(.htm)

S
erver

S
ide

I
nclude

file


(.inc)

ASP

Engine

(asp.dll)

JavaScript

Engine

VBScript

Engine

JScript

Engine

Request

Response

Server

Session

Application

Web Site

Web
Page




(.htm)