Download - Scripting APIs for the Web
![Page 1: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/1.jpg)
Scripting APIs for the Web
Dean Jackson
![Page 2: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/2.jpg)
![Page 3: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/3.jpg)
![Page 4: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/4.jpg)
![Page 5: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/5.jpg)
AJAXA.J.A.X
Ajax
![Page 6: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/6.jpg)
HTML1
Client Server
HTML2
HTML3
![Page 7: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/7.jpg)
HTML
Client Server
XMLHttpRequest
![Page 8: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/8.jpg)
Web APIs Working Group
![Page 9: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/9.jpg)
XMLHttpRequestWindow
![Page 10: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/10.jpg)
Application
Toolkit
Architecture
![Page 11: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/11.jpg)
![Page 12: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/12.jpg)
Standardise existing behaviour wherever
possible
1
![Page 13: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/13.jpg)
Get implementors involved
2
![Page 14: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/14.jpg)
Open channels of communication
(in both directions)
3
![Page 15: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/15.jpg)
Work quickly
4
![Page 16: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/16.jpg)
XMLHttpRequest
Allows a script to asynchronously fetch data from a remote host.
![Page 17: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/17.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/18.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/19.jpg)
• return codes
• setting headers
• security model
![Page 20: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/20.jpg)
XMLHttpRequest
http://www.w3.org/TR/XMLHttpRequest
![Page 21: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/21.jpg)
Window
An interface that allows a script to communicate with the browser
context.
![Page 22: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/22.jpg)
• location
• embedded documents
• timer methods
• security considerations
![Page 23: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/23.jpg)
// 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](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/24.jpg)
Window
http://www.w3.org/TR/Window
![Page 25: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/25.jpg)
DOM Level 3 Events
![Page 26: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/26.jpg)
• 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](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/27.jpg)
DOM Level 3 Events
http://www.w3.org/TR/DOM-Level-3-Events
![Page 28: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/28.jpg)
Remote Events for XML (REX)
http://www.w3.org/TR/REX
![Page 29: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/29.jpg)
Selectors
![Page 30: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/30.jpg)
XPath Selectorsvar imgs = document.evaluate(
"//img",
document,
null,
XPathResult.ANY_TYPE,
null);
![Page 31: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/31.jpg)
CSS Selectors
var imgs =
document.matchAll(“img”);
![Page 32: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/32.jpg)
• DOM Level 3 Core
• Client side storage
• File upload
• Better networking
• Timers
![Page 33: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/33.jpg)
Declarative vs Programmatic
Building a Web Operating System
![Page 34: Scripting APIs for the Web](https://reader035.vdocuments.us/reader035/viewer/2022071523/613d0e99736caf36b758cd8f/html5/thumbnails/34.jpg)
thanks!!!