26
Client-side & Server- side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality.

Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

Embed Size (px)

Citation preview

Page 1: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

Client-side & Server-side Scripting

©Richard L. Goldman

August 5, 2003

Requires PowerPoint 2002 or later for full functionality.

Page 2: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

2

©Richard L. Goldman

Simple HTML Web Page

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

Page 3: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

3

©Richard L. Goldman

Web ServerClient Computer

Simple Web Page

BrowserSoftware(IE)

WebServerSoftware(IIS)

Web Site

Web Page

(.htm)

Web Page

(.htm)

Web Page

(.htm)

Web Page

(.htm)

Web pagerequested

Web server sends Web page to client

Browser renders Web page

Page 4: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

4

©Richard L. Goldman

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.

Page 5: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

5

©Richard L. Goldman

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.

Page 6: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

6

©Richard L. Goldman

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>

Page 7: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

7

©Richard L. Goldman

Web ServerClient Computer

Client-side JavaScript

BrowserSoftware(IE)

WebServerSoftware(IIS)

Web Site

Web pagerequested

Web Page

(.htm)

Web Page

(.htm)

JavaScript

Web Page

(.htm)

Web Page

(.htm)

JavaScript

Server sends Web page (with script) to client

JavaScriptEngine

Page 8: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

8

©Richard L. Goldman

Web ServerClient Computer

Client-side JavaScript

BrowserSoftware(IE)

WebServerSoftware(IIS)

Web Site

Browser renders Web page

Web Page

(.htm)

Web Page

(.htm)

JavaScript

Web Page

(.htm)

Web Page

(.htm)

JavaScript

JavaScriptEngine

JavaScript

JavaScript engine processes the script

Page 9: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

9

©Richard L. Goldman

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”>

Page 10: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

10

©Richard L. Goldman

Web ServerClient Computer

Client-side External JavaScript

BrowserSoftware(IE)

WebServerSoftware(IIS)

Web Site

Web pagerequested

Web Page

(.htm)

Web Page

(.htm)

Script Call

Web Page

(.htm)

Web Page

(.htm)

Script Call

Server sends Web page (with script call) to client

ExtScript (.js)

ExtScript (.js)

JavaScriptEngine

Page 11: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

11

©Richard L. Goldman

Web ServerClient Computer

Client-side External JavaScript

BrowserSoftware(IE)

WebServerSoftware(IIS)

Web Site

Browser renders Web page

Browser calls external script

Web Page

(.htm)

Web Page

(.htm)

Script Call

Web Page

(.htm)

Web Page

(.htm)

Script call

ExtScript (.js)

ExtScript (.js)

JavaScriptEngine

Script call

External script is sent to client-side JavaScript engine

ExtScript (.js)

ExtScript (.js)

Page 12: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

12

©Richard L. Goldman

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.

Page 13: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

13

©Richard L. Goldman

Web ServerClient Computer

Client Side Script Engines

BrowserSoftware(IE)

JavaScriptEngine

VBScriptEngine

JScriptEngine

WebServerSoftware(IIS)

ECMAScriptEngine

Web Page

(.htm)

Web Page

(.htm)

Web Site

Web Page

(.htm)

Web Page

(.htm)

Page 14: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

14

©Richard L. Goldman

Server-side Script Software

Manufacturer Web Server Server-side Language/File Extension

Microsoft Internet Information Server (IIS) Active Server Page / .asp

Linux/Unix Apache PHP: Hypertext Processor / .php

Allaire Cold Fusion Cold Fusion Markup 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.

Page 15: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

15

©Richard L. Goldman

Web ServerClient Computer

Server-side VBScript (IIS & ASP)

BrowserSoftware(IE)

WebServerSoftware(IIS)

ASPEngine(asp.dll)

VBScriptEngine

Web Site

ASP pagerequested

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)VBScript

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)VBScript

Web server sends ASP page to ASP Engine

Page 16: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

16

©Richard L. Goldman

Web ServerClient Computer

Server-side VBScript

BrowserSoftware(IE)

WebServerSoftware(IIS)

ASPEngine(asp.dll)

VBScriptEngine

Web Site

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)VBScript

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)VBScript

Browser renders Web page

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

VBScript engine processes the script

Page 17: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

17

©Richard L. Goldman

Web ServerClient Computer

Server-side VBScript

BrowserSoftware(IE)

WebServerSoftware(IIS)

ASPEngine(asp.dll)

VBScriptEngine

Web Site

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)VBScript

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)

VBScript

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

Page 18: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

18

©Richard L. Goldman

External Server-side Scripts

Know as – Server Side Include (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”-->

Page 19: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

19

©Richard L. Goldman

Web ServerClient Computer

Server Side VBScript

BrowserSoftware(IE)

WebServerSoftware(IIS)

Web Page

(.htm)

Web Page

(.htm)

ASPEngine(asp.dll)

VBScriptEngine

Web Site

Web Page

(.htm)

Web Page

(.htm)SSI file (.inc)

SSI file (.inc)

ASP Page

(.asp)

ASP Page

(.asp)

Script Call

ASP Page

(.asp)

ASP Page

(.asp)

Script Call

ASP pagerequested

Web server sends ASP page to ASP Engine

Page 20: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

20

©Richard L. Goldman

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)

Page 21: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

21

©Richard L. Goldman

Web ServerClient Computer

Client-side & Server-side Script Engines

BrowserSoftware(IE)

JavaScriptEngine

VBScriptEngine

JScriptEngine

WebServerSoftware(IIS)

ECMAScriptEngine

ASPEngine(asp.dll)

JavaScriptEngine

VBScriptEngine

JScriptEngine

Web Site

Client-side script engines

Server-side script engines

Web Page

(.htm)

Web Page

(.htm)

Web Page

(.htm)

Web Page

(.htm)

Script Call

CS Script

ASP Page

(.asp)

ASP Page

(.asp)

SS Script

Script Call

Page 22: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

22

©Richard L. Goldman

Web ServerClient Computer

Server Side VBScript

BrowserSoftware(IE)

JavaScriptEngine

VBScriptEngine

JScriptEngine

WebServerSoftware(IIS)

ECMAScriptEngine

Web Page

(.htm)

Web Page

(.htm)

ASPEngine(asp.dll)

JavaScriptEngine

VBScriptEngine

JScriptEngine

Request

Response

Server

Session

Application

Web Site

Web Page

(.htm)

Web Page

(.htm)

Script Call

CS Script

ASP Page

(.asp)

ASP Page

(.asp)

SS Script

ExtScript (.js)

ExtScript (.js)

SSI file (.inc)

SSI file (.inc)

Script Call

Page 23: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

23

©Richard L. Goldman

Web ServerClient Computer

Server Side VBScript

BrowserSoftware(IE)

JavaScriptEngine

VBScriptEngine

JScriptEngine

WebServerSoftware(IIS)

ECMAScriptEngine

Web Page

(.htm)

Web Page

(.htm)

ASPEngine(asp.dll)

JavaScriptEngine

VBScriptEngine

JScriptEngine

Request

Response

Server

Session

Application

Web Site

Web Page

(.htm)

Web Page

(.htm)

Script Call

CS Script

ASP Page

(.asp)

ASP Page

(.asp)

SS Script

ExtScript (.js)

ExtScript (.js)

SSI file (.inc)

SSI file (.inc)

Script Call

Page 24: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

24

©Richard L. Goldman

Web ServerClient Computer

Server Side VBScript

BrowserSoftware(IE)

JavaScriptEngine

VBScriptEngine

JScriptEngine

WebServerSoftware(IIS)

ECMAScriptEngine

Web Page

(.htm)

Web Page

(.htm)

ASPEngine(asp.dll)

JavaScriptEngine

VBScriptEngine

JScriptEngine

Request

Response

Server

Session

Application

Web Site

Web Page

(.htm)

Web Page

(.htm)

Script Call

CS Script

ASP Page

(.asp)

ASP Page

(.asp)

SS Script

ExtScript (.js)

ExtScript (.js)

SSI file (.inc)

SSI file (.inc)

Script Call

Page 25: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

25

©Richard L. Goldman

Web ServerClient Computer

Server Side VBScript

BrowserSoftware(IE)

JavaScriptEngine

VBScriptEngine

JScriptEngine

WebServerSoftware(IIS)

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)

ECMAScriptEngine

Web Page

(.htm)

Web Page

(.htm)

ServerSideIncludefile (.inc)

ServerSideIncludefile (.inc)

ASPEngine(asp.dll)

JavaScriptEngine

VBScriptEngine

JScriptEngine

Request

Response

Server

Session

Application

Web Site

Web Page

(.htm)

Web Page

(.htm)

Page 26: Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality

26

©Richard L. Goldman

Web ServerClient Computer

Server Side VBScript

BrowserSoftware(IE)

JavaScriptEngine

VBScriptEngine

JScriptEngine

WebServerSoftware(IIS)

ActiveServerPage

(.asp)

ActiveServerPage

(.asp)

ECMAScriptEngine

Web Page

(.htm)

Web Page

(.htm)

ServerSideIncludefile (.inc)

ServerSideIncludefile (.inc)

ASPEngine(asp.dll)

JavaScriptEngine

VBScriptEngine

JScriptEngine

Request

Response

Server

Session

Application

Web Site

Web Page

(.htm)

Web Page

(.htm)