scripting apis for the web

35
Scripting APIs for the Web Dean Jackson

Upload: others

Post on 12-Sep-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Scripting APIs for the Web

Scripting APIs for the Web

Dean Jackson

Page 2: Scripting APIs for the Web
Page 3: Scripting APIs for the Web
Page 4: Scripting APIs for the Web
Page 5: Scripting APIs for the Web

AJAXA.J.A.X

Ajax

Page 6: Scripting APIs for the Web

HTML1

Client Server

HTML2

HTML3

Page 7: Scripting APIs for the Web

HTML

Client Server

XMLHttpRequest

Page 8: Scripting APIs for the Web

Web APIs Working Group

Page 9: Scripting APIs for the Web

XMLHttpRequestWindow

Page 10: Scripting APIs for the Web

Application

Toolkit

Architecture

Page 11: Scripting APIs for the Web
Page 12: Scripting APIs for the Web

Standardise existing behaviour wherever

possible

1

Page 13: Scripting APIs for the Web

Get implementors involved

2

Page 14: Scripting APIs for the Web

Open channels of communication

(in both directions)

3

Page 15: Scripting APIs for the Web

Work quickly

4

Page 16: Scripting APIs for the Web

XMLHttpRequest

Allows a script to asynchronously fetch data from a remote host.

Page 17: Scripting APIs for the Web

var req = new XMLHttpRequest();req.open('GET', '/favourite-animals', false);req.send(null);

if (req.status == 200) { // 200 is HTTP OK alert(req.getResponseHeader(’Content-Type’)); alert(req.responseText);}

Page 18: Scripting APIs for the Web

HTTP/1.1 200 OKDate: Wed, 24 May 2006 11:38:08 GMTServer: Apache/1.3.33 (Darwin) PHP/4.4.1Last-Modified: Wed, 24 May 2006 11:37:40 GMTETag: "13b15b-33-44744584"Accept-Ranges: bytesContent-Length: 51Content-Type: text/plain

koalakangaroowallabyemuplatypusechidnawombat

Page 19: Scripting APIs for the Web

• return codes

• setting headers

• security model

Page 20: Scripting APIs for the Web

XMLHttpRequest

http://www.w3.org/TR/XMLHttpRequest

Page 21: Scripting APIs for the Web

Window

An interface that allows a script to communicate with the browser

context.

Page 22: Scripting APIs for the Web

• location

• embedded documents

• timer methods

• security considerations

Page 23: Scripting APIs for the Web

// we don’t need to use document.window as// window is the default ECMAscript context

// create a function to be called in a while

function ping() { alert(”Hello Ediburgh!”);}

// call the ping function in 1000 milliseconds

var timerID = setTimeout(ping, 1000);

Page 24: Scripting APIs for the Web

Window

http://www.w3.org/TR/Window

Page 25: Scripting APIs for the Web

DOM Level 3 Events

Page 26: Scripting APIs for the Web

• added support for namespaced events

• new event types

• deprecating/simplifying some features

• community feedback on whether event groups are needed

Page 27: Scripting APIs for the Web

DOM Level 3 Events

http://www.w3.org/TR/DOM-Level-3-Events

Page 28: Scripting APIs for the Web

Remote Events for XML (REX)

http://www.w3.org/TR/REX

Page 29: Scripting APIs for the Web

Selectors

Page 30: Scripting APIs for the Web

XPath Selectorsvar imgs = document.evaluate(

"//img",

document,

null,

XPathResult.ANY_TYPE,

null);

Page 31: Scripting APIs for the Web

CSS Selectors

var imgs =

document.matchAll(“img”);

Page 32: Scripting APIs for the Web

• DOM Level 3 Core

• Client side storage

• File upload

• Better networking

• Timers

Page 33: Scripting APIs for the Web

Declarative vs Programmatic

Building a Web Operating System

Page 34: Scripting APIs for the Web

thanks!!!