Mashing up JavaScript – Advanced Techniques for modern Web Apps
-
Upload
bastian-hofmann -
Category
Technology
-
view
5.752 -
download
2
description
Transcript of Mashing up JavaScript – Advanced Techniques for modern Web Apps
![Page 1: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/1.jpg)
Mashing up JavaScriptAdvanced techniques for modern web applications
Bastian HofmannVZnet Netzwerke Ltd.
![Page 2: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/2.jpg)
Wtf?
![Page 3: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/3.jpg)
![Page 4: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/4.jpg)
![Page 5: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/5.jpg)
![Page 6: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/6.jpg)
![Page 7: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/7.jpg)
![Page 8: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/8.jpg)
![Page 9: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/9.jpg)
![Page 10: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/10.jpg)
• JavaScript Apps
• CORS and OAuth2
• Local Storage
• OEmbed and Caja
• WebSockets, ActivityStrea.ms and PubsubHubbub
![Page 11: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/11.jpg)
![Page 12: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/12.jpg)
![Page 13: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/13.jpg)
![Page 14: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/14.jpg)
![Page 16: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/16.jpg)
https://github.com/bashofmann/statusnet_js_mashup
![Page 17: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/17.jpg)
Let‘s write a JS App
![Page 18: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/18.jpg)
History & Bookmarking
![Page 21: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/21.jpg)
API Access
![Page 22: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/22.jpg)
![Page 23: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/23.jpg)
Same Origin Policy
![Page 24: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/24.jpg)
Cross-Origin Resource Sharing
Backendapi.twitter.com
Client client.net
AJAX
Access-Control-Allow-Origin: *
http://www.w3.org/TR/cors/
![Page 25: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/25.jpg)
var html="<ul>";for (var i=0; i < viewers.length; i++) { html += "<li>" + viewers[i].displayName + "</li>";}html += "<ul>";document.getElementById("#div").innerHTML = html;
Where is the error?
![Page 26: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/26.jpg)
Templates
![Page 27: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/27.jpg)
Mustache.JS
https://github.com/janl/mustache.js
}
![Page 28: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/28.jpg)
var feed = [];var app = Sammy('#main', function() { this.use(Sammy.Mustache, 'ms'); this.get('#/', function() { this.trigger('getFeed'); }); ...});
jQuery(function() { app.run('#/');});
![Page 29: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/29.jpg)
var feed = [];var app = Sammy('#main', function() { this.use(Sammy.Mustache, 'ms'); this.get('#/', function() { this.trigger('getFeed'); }); ...});
jQuery(function() { app.run('#/');});
![Page 30: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/30.jpg)
var feed = [];var app = Sammy('#main', function() { this.use(Sammy.Mustache, 'ms'); this.get('#/', function() { this.trigger('getFeed'); }); ...});
jQuery(function() { app.run('#/');});
![Page 31: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/31.jpg)
var feed = [];var app = Sammy('#main', function() { this.use(Sammy.Mustache, 'ms'); this.get('#/', function() { this.trigger('getFeed'); }); ...});
jQuery(function() { app.run('#/');});
![Page 32: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/32.jpg)
var feed = [];var app = Sammy('#main', function() { this.use(Sammy.Mustache, 'ms'); this.get('#/', function() { this.trigger('getFeed'); }); ...});
jQuery(function() { app.run('#/');});
![Page 33: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/33.jpg)
this.bind('getFeed', function() { var that = this; $.ajax({ url: 'http://..._timeline.json', success: function(response) { feed = response; that.trigger('renderFeed'); } }); }); this.bind('renderFeed', function() { this.feed = feed; this.partial('js/templates/feed.ms'); });
![Page 34: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/34.jpg)
this.bind('getFeed', function() { var that = this; $.ajax({ url: 'http://..._timeline.json', success: function(response) { feed = response; that.trigger('renderFeed'); } }); }); this.bind('renderFeed', function() { this.feed = feed; this.partial('js/templates/feed.ms'); });
![Page 35: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/35.jpg)
this.bind('getFeed', function() { var that = this; $.ajax({ url: 'http://..._timeline.json', success: function(response) { feed = response; that.trigger('renderFeed'); } }); }); this.bind('renderFeed', function() { this.feed = feed; this.partial('js/templates/feed.ms'); });
![Page 36: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/36.jpg)
this.bind('getFeed', function() { var that = this; $.ajax({ url: 'http://..._timeline.json', success: function(response) { feed = response; that.trigger('renderFeed'); } }); }); this.bind('renderFeed', function() { this.feed = feed; this.partial('js/templates/feed.ms'); });
![Page 37: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/37.jpg)
this.bind('getFeed', function() { var that = this; $.ajax({ url: 'http://..._timeline.json', success: function(response) { feed = response; that.trigger('renderFeed'); } }); }); this.bind('renderFeed', function() { this.feed = feed; this.partial('js/templates/feed.ms'); });
![Page 38: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/38.jpg)
this.bind('getFeed', function() { var that = this; $.ajax({ url: 'http://..._timeline.json', success: function(response) { feed = response; that.trigger('renderFeed'); } }); }); this.bind('renderFeed', function() { this.feed = feed; this.partial('js/templates/feed.ms'); });
![Page 39: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/39.jpg)
<ul>{{#feed}} <li> <p>{{{statusnet_html}}}</p> <p>{{created_at}} {{#user}} {{name}} {{/user}} </p> </li>{{/feed}}</ul>
![Page 40: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/40.jpg)
<ul>{{#feed}} <li> <p>{{{statusnet_html}}}</p> <p>{{created_at}} {{#user}} {{name}} {{/user}} </p> </li>{{/feed}}</ul>
![Page 41: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/41.jpg)
<ul>{{#feed}} <li> <p>{{{statusnet_html}}}</p> <p>{{created_at}} {{#user}} {{name}} {{/user}} </p> </li>{{/feed}}</ul>
![Page 42: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/42.jpg)
<ul>{{#feed}} <li> <p>{{{statusnet_html}}}</p> <p>{{created_at}} {{#user}} {{name}} {{/user}} </p> </li>{{/feed}}</ul>
![Page 43: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/43.jpg)
DEMO
![Page 44: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/44.jpg)
Authorization
![Page 45: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/45.jpg)
![Page 46: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/46.jpg)
+----------+ Client Identifier +----------------+ | |>---(A)-- & Redirection URI --->| | | | | | End <--+ - - - +----(B)-- User authenticates -->| Authorization | User | | | Server | | |<---(C)--- Redirect URI -------<| | | Client | with Access Token | | | in | in Fragment +----------------+ | Browser | | | +----------------+ | |>---(D)--- Redirect URI ------->| | | | without Fragment | Web Server | | | | with Client | | (F) |<---(E)--- Web Page with ------<| Resource | | Access | Script | | | Token | +----------------+ +----------+
OAuth 2
http://tools.ietf.org/html/draft-ietf-oauth-v2
![Page 47: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/47.jpg)
this.bind('getFeed', function() { oauth2.retrieveAccessToken(); if (! oauth2.store['access_token']) { this.redirect('#Login'); return; } ... });
![Page 48: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/48.jpg)
this.bind('getFeed', function() { oauth2.retrieveAccessToken(); if (! oauth2.store['access_token']) { this.redirect('#Login'); return; } ... });
![Page 49: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/49.jpg)
this.get('#Login', function() { var consumerKey = 'abc....'; window.open('http://status.net/api/oauth2/authorize?response_toke=token&client_id=' + consumerKey);});
![Page 50: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/50.jpg)
this.get('#Login', function() { var consumerKey = 'abc....'; window.open('http://status.net/api/oauth2/authorize?response_toke=token&client_id=' + consumerKey);});
![Page 51: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/51.jpg)
<script type="text/javascript"> var fragment = location.hash.substr(1); opener.parent.oauth2.storeToken(fragment); window.close();</script>
![Page 52: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/52.jpg)
<script type="text/javascript"> var fragment = location.hash.substr(1); opener.parent.oauth2.storeToken(fragment); window.close();</script>
![Page 53: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/53.jpg)
<script type="text/javascript"> var fragment = location.hash.substr(1); opener.parent.oauth2.storeToken(fragment); window.close();</script>
![Page 54: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/54.jpg)
<form action="#Entry" method="post"> <textarea name="comment"></textarea> <input type="submit" value="send"/></form>
![Page 55: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/55.jpg)
<form action="#Entry" method="post"> <textarea name="comment"></textarea> <input type="submit" value="send"/></form>
![Page 56: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/56.jpg)
<form action="#Entry" method="post"> <textarea name="comment"></textarea> <input type="submit" value="send"/></form>
![Page 57: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/57.jpg)
this.post('#Entry', function() { var that = this; $.ajax({ url: 'http://status.net/.../update.json?oauth_token=' + oauth2.store['access_token'], type: 'POST', data: { 'status': that.params['comment'] }, success: function() { that.redirect('#/'); } }); });
![Page 58: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/58.jpg)
this.post('#Entry', function() { var that = this; $.ajax({ url: 'http://status.net/.../update.json?oauth_token=' + oauth2.store['access_token'], type: 'POST', data: { 'status': that.params['comment'] }, success: function() { that.redirect('#/'); } }); });
![Page 59: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/59.jpg)
this.post('#Entry', function() { var that = this; $.ajax({ url: 'http://status.net/.../update.json?oauth_token=' + oauth2.store['access_token'], type: 'POST', data: { 'status': that.params['comment'] }, success: function() { that.redirect('#/'); } }); });
![Page 60: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/60.jpg)
this.post('#Entry', function() { var that = this; $.ajax({ url: 'http://status.net/.../update.json?oauth_token=' + oauth2.store['access_token'], type: 'POST', data: { 'status': that.params['comment'] }, success: function() { that.redirect('#/'); } }); });
![Page 61: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/61.jpg)
this.post('#Entry', function() { var that = this; $.ajax({ url: 'http://status.net/.../update.json?oauth_token=' + oauth2.store['access_token'], type: 'POST', data: { 'status': that.params['comment'] }, success: function() { that.redirect('#/'); } }); });
![Page 62: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/62.jpg)
this.post('#Entry', function() { var that = this; $.ajax({ url: 'http://status.net/.../update.json?oauth_token=' + oauth2.store['access_token'], type: 'POST', data: { 'status': that.params['comment'] }, success: function() { that.redirect('#/'); } }); });
![Page 63: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/63.jpg)
Storing the access token
![Page 64: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/64.jpg)
Local Storage
http://www.w3.org/TR/webstorage/
![Page 65: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/65.jpg)
localStorage.setItem("key", value);
![Page 66: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/66.jpg)
localStorage.getItem("key");
![Page 67: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/67.jpg)
DEMO
![Page 68: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/68.jpg)
Mash it up!
![Page 69: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/69.jpg)
cool video:http://www.youtube.com/watch?v=OFzkTxiwziQ
![Page 71: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/71.jpg)
http://www.youtube.com/watch?v=OyJd2qsRkNk
![Page 72: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/72.jpg)
![Page 73: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/73.jpg)
http://www.youtube.com/oembed?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv
%3DOyJd2qsRkNk&maxwidth=500&format=json
![Page 74: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/74.jpg)
{ "provider_url":"http:\/\/www.youtube.com\/", "title":"Jupiter Jones - Das Jahr in dem ich schlief (Musik Video)", "html":"\u003cobject width=\"500\" height=\"306\"\u003e\u003cparam name=\"movie\" value=\"http:\/\/www.youtube.com\/v\/OyJd2qsRkNk?version=3\"\u003e\u003c\/param\u003e\u003cparam name=\"allowFullScreen\" value=\"true\"\u003e\u003c\/param\u003e\u003cparam name=\"allowscriptaccess\" value=\"always\"\u003e\u003c\/param\u003e\u003cembed src=\"http:\/\/www.youtube.com\/v\/OyJd2qsRkNk?version=3\" type=\"application\/x-shockwave-flash\" width=\"500\" height=\"306\" allowscriptaccess=\"always\" allowfullscreen=\"true\"\u003e\u003c\/embed\u003e\u003c\/object\u003e", "author_name":"St182", "height":306, "thumbnail_width":480, "width":500, "version":"1.0", "author_url":"http:\/\/www.youtube.com\/user\/Stinkfist182", "provider_name":"YouTube", "thumbnail_url":"http:\/\/i4.ytimg.com\/vi\/OyJd2qsRkNk\/hqdefault.jpg", "type":"video", "thumbnail_height":360}
![Page 75: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/75.jpg)
cool video:
![Page 77: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/77.jpg)
![Page 78: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/78.jpg)
Caja
http://code.google.com/p/google-caja/
![Page 79: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/79.jpg)
html_sanitize(‘<script>alert(“foo“);</script>‘)
![Page 80: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/80.jpg)
DEMO
![Page 81: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/81.jpg)
Instant updates without reloading
![Page 82: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/82.jpg)
PubSubHubbubretrieves Atom feed with Hub URL
Hub
posts sthpings everysubscriber
subscribes for feed
ackssubscription
http://code.google.com/p/pubsubhubbub/
![Page 83: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/83.jpg)
<link rel="alternate"href="http://status.net.xyz:8061/index.php/api/statuses/user_timeline/3.atom"type="application/atom+xml" title="Notice feed for bastian (Atom)"/>
![Page 84: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/84.jpg)
<entry> <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type> <id>http://status.net.xyz:8061/index.php/notice/20</id> <title>hello from client</title> <content type="html">hello from client</content> <link rel="alternate" type="text/html" href="http://status.net.xyz:8061/index.php/notice/20"/> <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> <published>2011-05-23T21:07:33+00:00</published> <updated>2011-05-23T21:07:33+00:00</updated> <link rel="ostatus:conversation" href="http://status.net.xyz:8061/index.php/conversation/20"/> <georss:point>52.52437 13.41053</georss:point> <link rel="self" type="application/atom+xml"href="http://status.net.xyz:8061/index.php/api/statuses/show/20.atom"/> <link rel="edit" type="application/atom+xml"href="http://status.net.xyz:8061/index.php/api/statuses/show/20.atom"/> <statusnet:notice_info local_id="20" source="api" favorite="false"repeated="false"></statusnet:notice_info></entry>
![Page 86: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/86.jpg)
<link href="http://status.net.xyz:8061/index.php/main/push/hub" rel="hub"/>
![Page 87: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/87.jpg)
PubSubHubbubretrieves Atom feed with Hub URL
Hub
posts sthpings everysubscriber
subscribes for feed
ackssubscription
http://code.google.com/p/pubsubhubbub/
![Page 89: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/89.jpg)
WebSockets
http://dev.w3.org/html5/websockets/
![Page 91: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/91.jpg)
Browser Notifications
![Page 92: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/92.jpg)
webkitNotifications.createNotification(image, title, text).show();
![Page 93: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/93.jpg)
webkitNotifications.requestPermission();
![Page 94: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/94.jpg)
retrieve Stream with Hub
Ajax: request Subscription
WebSockets:new Post
subscribe at hubchallenge
acknew post
Notification
new post
![Page 95: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/95.jpg)
DEMO
![Page 96: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/96.jpg)
http://bit.ly/oscon_js_mashup
Rate and Comment
![Page 97: Mashing up JavaScript – Advanced Techniques for modern Web Apps](https://reader033.fdocuments.in/reader033/viewer/2022052505/5560bffad8b42af43b8b5344/html5/thumbnails/97.jpg)
h"p://twi"er.com/Bas2anHofmannh"p://profiles.google.com/bashofmannh"p://lanyrd.com/people/Bas2anHofmann/h"p://slideshare.net/bashofmann