SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
MOBILE WEB
5.0
Michael Galpin, eBay
WHO AM I?
               Michael Galpin

       Mobile Architect, eBay

       Android & Mobile Web

   Author, Android in Practice

                   @michaelg
WHY?
Mobile is the new HOTness
MO BILE
W   E   B
            THE IPHONE MYTH
MO BILE     2 BIRDS, 1
            STONE?
W   E   B
MO BILE
            ONE WEBKIT TO
W   E   B
            RULE THEM
            ALL?
MO BILE
            ONE WEBKIT TO
W   E   B
            RULE THEM
            ALL?



            Android 2.2.1   iOS 4.1
MOBILE
            PARTY LIKE IT’S
W   E   B
            2022
WHAT?
WHAT ABOUT?
OMG! VIDEO TAG!!!
HTML
JavaScript



HTML
         CSS 3.0
MO BILE
            JUST ADD
W   E   B
            VIEWPORT?
HOW?
MO BILE
W   E   B   GEOLOCATION
              geocoder = new google.maps.Geocoder();
              if (navigator.geolocation){
                  var gps = navigator.geolocation;
                  gps.getCurrentPosition(function(pos){
                      var latLng = new google.maps.LatLng(pos.coords.latitude,pos.coords.longitude);
                      var opts = {zoom:12, center:latLng, mapTypeId: google.maps.MapTypeId.ROADMAP};
                      map = new google.maps.Map($("map_canvas"), opts);
                      theUser = new google.maps.Marker({
                          position: latLng,
                          map: map,
                          title: "You!"
                      });
                  });
                  trackerId = gps.watchPosition(function(pos){
                      var latLng = new google.maps.LatLng(pos.coords.latitude,pos.coords.longitude);
                      map.setCenter(latLng);
                      theUser.setPosition(latLng);
                  });
              }
MO BILE
W   E   B     GEOLOCATION
        OS/Browser   Status/Version

                     3.0

                     2.0

                     6.0

                     X

                     X
MO BILE
W   E   B   DOM STORAGE
              if (window.localStorage){
                  localStorage.setItem("tweet" + tweet.id, JSON.stringify(tweet));
                  var index = localStorage.getItem("index::" + keyword);
                  if (index){
                      index = JSON.parse(index);
                  } else {
                      index = [];
                  }
                  index.push(tweet.id);
                  localStorage.setItem("index::"+keyword, JSON.stringify(index));
              }
MO BILE
W   E   B   DOM STORAGE
              if (window.localStorage){
                  localStorage.setItem("tweet" + tweet.id, JSON.stringify(tweet));
                  var index = localStorage.getItem("index::" + keyword);
                  if (index){
                      index = JSON.parse(index);
                  } else {
                      index = [];
                  }
                  index.push(tweet.id);
                  localStorage.setItem("index::"+keyword, JSON.stringify(index));
              }
MO BILE
W   E   B     DOM STORAGE
        OS/Browser   Status/Version

                     3.0

                     2.0

                     6.0

                     7.0

                     X
MO BILE
W   E   B   WEB WORKERS
                 var worker = new Worker("details.js");
                 worker.onmessage = function(message){
                     var responseXmlStr = message.data.responseXml;
                     var itemDetails = parseFromXml(responseXmlStr);
                     if (window.localStorage){
                         localStorage.setItem(itemDetails.id, responseXmlStr);
                     }
                     dealDetails[itemDetails.id] = itemDetails;
                 };
                 worker.postMessage(item.itemId);




                 onmessage = function(message){
                     var itemId = message.data;
                     var xhr = new XMLHttpRequest();
                     xhr.onreadystatechange = function(){
                         if (this.readyState == 4 && this.status == 200){
                             postMessage({responseXml: this.responseText});
                         }
                     };
                     var urlStr = generateUrl(itemId);
                     xhr.open("GET", "proxy?url=" + escape(urlStr));
                     xhr.send(null);
                 }
MO BILE
W   E   B     WEB WORKERS
        OS/Browser   Status/Version

                     X

                     2.0

                     6.0

                     X

                     X
MO BILE
W   E   B   WEBSOCKET
                    if (window.WebSocket){
                        var conn = new WebSocket("ws://my.server.com/socket");
                        conn.onopen = function(){
                            setStatusMessage('connecting...');
                            conn.send('connect');
                        };
                        conn.onmessage = function(msg){
                            setStatusMessage('connected');
                            updateItemStatus(JSON.parse(msg.data));
                        };
                a
            at




                        conn.onerror = function(err){
            D




                            showError(err);
                            conn.close();
                        };
                        conn.onclose = function(evt){
                            setStatusMessage('connection closed');
                        };
                    }
MO BILE
W   E   B     WEBSOCKET
        OS/Browser   Status/Version

                     4.2b

                     X

                     X

                     X

                     X
MOBILE
W   E   B   CANVAS
               var ctx = $("graph").getContext("2d");
               ctx.font = "bold 12px sans-serif";
               ctx.textAlign = "start";
               for (i=0;i<data.length;i++){
                   ctx.fillStyle = "rgba(0, 0, 200, 0.9)";
                   ctx.fillRect(x, maxHeight - (data[i][report.y] / 2), width,
                       (data[i][report.y] / 2));
                   ctx.fillStyle = "rgba(0, 0, 0, 0.9)";
                   ctx.fillText(data[i][report.x], x + (width / 4),
                       maxHeight + 15);
                   x += width + buffer;
               }
               ctx.moveTo(axisBuffer, maxHeight);
               ctx.lineTo(axisBuffer+maxWidth, maxHeight);
               ctx.strokeStyle = "black";
               ctx.stroke();
               ctx.moveTo(axisBuffer,0);
               ctx.lineTo(axisBuffer,maxHeight);
               ctx.stroke();
MO BILE
W   E   B     CANVAS
        OS/Browser   Status/Version

                     1.0

                     1.0

                     6.0

                     X

                     v2
MOBILE
W   E   B   CSS 3.0

                $("formSection").style["-webkit-transform"] = "rotateZ(-5deg)";
                $("formSection").style["-webkit-transition"] =
                    "-webkit-transform 2s ease-in-out";
                $("rtBtn").innerHTML = "Undo";
                $("rtBtn").onclick = function() {
                    $("formSection").style["-webkit-transform"] = "";
                    $("rtBtn").innerHTML = "Rotate";
                    $("rtBtn").setAttribute("onclick", "rotate()");
                }
MORE CSS 3.0
                                                     .abc {
tr:nth-child(4n+1) { color: navy; }                       border: 1px solid #000;
tr:nth-child(4n+2) { color: green; }                      border-radius: 9px;
tr:nth-child(4n+3) { color: maroon; }                     -webkit-column-count:4;
tr:nth-child(4n+4) { color: purple; }                     -webkit-column-rule: 1px solid #a00;
header > h1{                                              -webkit-column-gap: 0.75em;
    color: yellow;                                   }
    background: -webkit-gradient(linear, left top,   h2 {
        left bottom, from(blue), to(white))               -webkit-text-fill-color: blue;
}                                                         -webkit-text-stroke-color: yellow;
.xyz{                                                     -webkit-text-stroke-width: 1.5px;
    text-shadow: #6374AB 4px -4px 2px;                    background: -webkit-gradient(radial, 430 50, 0,
    overflow: hidden;                                         430 50, 200, from(red), to(#000));
    text-overflow: ellipsis;                              -webkit-box-reflect:below 5px -webkit-gradient(
    border: 1px solid #bbb;                                   linear, left top, left bottom,
    border-radius: 9px;                                       from(transparent),
    background-color: #fff;                                   color-stop(0.5, transparent), to(white));
}                                                    }
MO BILE
W   E   B     CSS 3.0
        OS/Browser   Status/Version

                     3.0

                     2.0

                     X

                     X

                     X
MO BILE
            APPLICATION
W   E   B
            CACHE  <!DOCTYPE html>
                   <html manifest="manifest.mf">
                   <head>
                       <!-- ... -->
                   </head>
                   <body>
                       <!-- ... -->
                   </body>
                   </html>




                   CACHE MANIFEST
                   # Version 0.2
                   CACHE:
                   offline.html
                   json2.js
                   /images/gym.jpg
                   /images/soccer.jpg
                   /images/online.jpg

                   NETWORK:
                   http://search.twitter.com/
MO BILE
W   E   B     APPLICATION
        OS/Browser   Status/Version

                     2.0

                     2.0

                     6.0

                     X

                     X
DEVICE
MOBILE
W   E   B


              if (navigator.device.captureImage){
                  device.captureImage(function(data){
                      var file = data[0];
                      var xhr = new XMLHttpRequest();
                      xhr.upload.addEventListener("progress", function(e) {
                          if (e.lengthComputable) {
                              var percentage = Math.round((e.loaded * 100) / e.total);
                              updateStatusBar(percentage);
                          }
                      }, false);
                      xhr.open("POST", "http://my.server.com/upload");
                      xhr.overrideMimeType('text/plain; charset=x-user-defined-binary');
                      xhr.sendAsBinary(file.getAsBinary());
                  });
              }
MO BILE
W   E   B     DEVICE
        OS/Browser     Status/Version

                       X

                       3.0

                       X

                       X

                       X
MO BILE
W   E   B   TOUCH EVENTS
                 logo.ontouchmove = function(event){
                     if (event.touches.length == 1){
                         event.preventDefault();
                         var touch = event.touches[0];
                         var node = touch.target;
                         node.style.position = "absolute";
                         node.style.left = touch.pageX + "px";
                         node.style.top = touch.pageY + "px";
                     }
                 }

                 var angle = 0;
                 logo.ongesturechange = function(event){
                     var node = event.target;
                     node.style.webkitTransform = "rotate("+
                         ((angle + event.rotation) % 360)+"deg)";
                 }
                 logo.ongestureend = function(event){
                     angle = (angle + event.rotation) % 360;
                 }
MO BILE
W   E   B     TOUCH EVENTS
        OS/Browser   Status/Version

                     2.0

                     1.0

                     6.0?

                     X

                     X
MO BILE
W   E   B   AUDIO/VIDEO

                  <video controls="controls" preload="true"
                      width="720" height="640">
                      <source src="feature.ogg" type="video/ogg" />
                      <source src="feature.mp4" type="video/mp4" />
                      Your browser sucks
                  </video>
MO BILE
W   E   B     AUDIO/VIDEO
        OS/Browser   Status/Version

                     1.0

                     2.0

                     X

                     X

                     X
MO BILE
W   E   B   META
                   <meta name="viewport" content="width=device-width; user-
                   scalable=no;"/>
                   <meta name="apple-touch-fullscreen" content="YES" />
                   <meta name="apple-mobile-web-app-capable" content="yes" />
                   <meta name="apple-mobile-web-app-status-bar-style"
                   content="black" />
                   <link rel="apple-touch-icon" href="rice-and-bones.png"/>
NO REALLY,
HOW?
MOBILE
                 BEST
W   E       B
                 PRACTICES
        •   Servers are for data

        •   Orientation matters

        •   Cache, cache, cache

        •   Frameworks (not really mobile): SproutCore, Cappuccino

        •   Frameworks (mobile): Sencha, jQTouch

Contenu connexe

Tendances

Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
MongoSF
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventas
DAYANA RETO
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 
mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
zefhemel
 

Tendances (20)

Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
 
はじめてのMongoDB
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDB
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventas
 
Indexing
IndexingIndexing
Indexing
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - Guilin
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Visual Studio.Net - Sql Server
Visual Studio.Net - Sql ServerVisual Studio.Net - Sql Server
Visual Studio.Net - Sql Server
 
ABCD firebase
ABCD firebaseABCD firebase
ABCD firebase
 
Map/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDBMap/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDB
 
Grails UI Primer
Grails UI PrimerGrails UI Primer
Grails UI Primer
 
mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
 
MongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() OutputMongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() Output
 
BVJS
BVJSBVJS
BVJS
 
Baitap tkw
Baitap tkwBaitap tkw
Baitap tkw
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
 
Introduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genIntroduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10gen
 
Mongo db modifiers
Mongo db modifiersMongo db modifiers
Mongo db modifiers
 

En vedette

JSX - 公開から1年を迎えて
JSX - 公開から1年を迎えてJSX - 公開から1年を迎えて
JSX - 公開から1年を迎えて
Kazuho Oku
 
Bull Snakes by Marcus Barraza
Bull Snakes by Marcus BarrazaBull Snakes by Marcus Barraza
Bull Snakes by Marcus Barraza
vebrya
 
Black Footed Fettet by Kirsten
Black  Footed Fettet by KirstenBlack  Footed Fettet by Kirsten
Black Footed Fettet by Kirsten
vebrya
 
Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...
Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...
Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...
www.erickson.it
 
電腦網路 網路安全
電腦網路 網路安全電腦網路 網路安全
電腦網路 網路安全
bruce761207
 
Competency Based Educ@tion
Competency Based Educ@tionCompetency Based Educ@tion
Competency Based Educ@tion
Martin Rehm
 
Brand>ing You - Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet Iasi
Brand>ing You -  Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet IasiBrand>ing You -  Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet Iasi
Brand>ing You - Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet Iasi
Adrian Mironescu
 

En vedette (20)

FlorilèGe
FlorilèGeFlorilèGe
FlorilèGe
 
JSX - 公開から1年を迎えて
JSX - 公開から1年を迎えてJSX - 公開から1年を迎えて
JSX - 公開から1年を迎えて
 
Bull Snakes by Marcus Barraza
Bull Snakes by Marcus BarrazaBull Snakes by Marcus Barraza
Bull Snakes by Marcus Barraza
 
Corey Makes Healthcare - Coordinate, Efficient and Mobile
Corey Makes Healthcare - Coordinate, Efficient and MobileCorey Makes Healthcare - Coordinate, Efficient and Mobile
Corey Makes Healthcare - Coordinate, Efficient and Mobile
 
Black Footed Fettet by Kirsten
Black  Footed Fettet by KirstenBlack  Footed Fettet by Kirsten
Black Footed Fettet by Kirsten
 
Suisse
SuisseSuisse
Suisse
 
'Fotografia privata' su Web: microstorie del Novecento
'Fotografia privata' su Web: microstorie del Novecento'Fotografia privata' su Web: microstorie del Novecento
'Fotografia privata' su Web: microstorie del Novecento
 
We b development trends
We b  development  trendsWe b  development  trends
We b development trends
 
Is social media a fixture or fad in latin american politics
Is social media a fixture or fad in latin american politicsIs social media a fixture or fad in latin american politics
Is social media a fixture or fad in latin american politics
 
1.1 Sg Key
1.1 Sg Key1.1 Sg Key
1.1 Sg Key
 
Twitter For Business
Twitter For BusinessTwitter For Business
Twitter For Business
 
Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...
Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...
Livelli Essenziali Di Qualita’ Dell’Integrazione. Dario Ianes. Edizioni Erick...
 
電腦網路 網路安全
電腦網路 網路安全電腦網路 網路安全
電腦網路 網路安全
 
Competency Based Educ@tion
Competency Based Educ@tionCompetency Based Educ@tion
Competency Based Educ@tion
 
Core Skills for Content Administrators
Core Skills for Content AdministratorsCore Skills for Content Administrators
Core Skills for Content Administrators
 
Tablet ecosystem in_india-facts_&_figures
Tablet ecosystem in_india-facts_&_figuresTablet ecosystem in_india-facts_&_figures
Tablet ecosystem in_india-facts_&_figures
 
Upping engagement with digital resources
Upping engagement with digital resourcesUpping engagement with digital resources
Upping engagement with digital resources
 
A Long Walk to Water: Lesson17 unit2
A Long Walk to Water: Lesson17 unit2A Long Walk to Water: Lesson17 unit2
A Long Walk to Water: Lesson17 unit2
 
Brand>ing You - Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet Iasi
Brand>ing You -  Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet IasiBrand>ing You -  Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet Iasi
Brand>ing You - Adrian Mironescu ( Idegrafo ) mart'10, GeekMeet Iasi
 
cyREST: Cytoscape as a Service
cyREST: Cytoscape as a ServicecyREST: Cytoscape as a Service
cyREST: Cytoscape as a Service
 

Similaire à Mobile Web 5.0

Average- An android project
Average- An android projectAverage- An android project
Average- An android project
Ipsit Dash
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010
Ismael Celis
 
! Modernizr v2.0.6 httpwww.modernizr.com Copyri.docx
!  Modernizr v2.0.6  httpwww.modernizr.com   Copyri.docx!  Modernizr v2.0.6  httpwww.modernizr.com   Copyri.docx
! Modernizr v2.0.6 httpwww.modernizr.com Copyri.docx
MARRY7
 
WebSocket JSON Hackday
WebSocket JSON HackdayWebSocket JSON Hackday
WebSocket JSON Hackday
Somay Nakhal
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-future
yiming he
 
Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of today
gerbille
 

Similaire à Mobile Web 5.0 (20)

NoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love Story
 
Average- An android project
Average- An android projectAverage- An android project
Average- An android project
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010
 
MySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsMySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of Things
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDb
 
! Modernizr v2.0.6 httpwww.modernizr.com Copyri.docx
!  Modernizr v2.0.6  httpwww.modernizr.com   Copyri.docx!  Modernizr v2.0.6  httpwww.modernizr.com   Copyri.docx
! Modernizr v2.0.6 httpwww.modernizr.com Copyri.docx
 
Html5 and web technology update
Html5 and web technology updateHtml5 and web technology update
Html5 and web technology update
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
Full Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQLFull Stack Development with Node.js and NoSQL
Full Stack Development with Node.js and NoSQL
 
mobl
moblmobl
mobl
 
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
 
Cnam azure 2014 mobile services
Cnam azure 2014   mobile servicesCnam azure 2014   mobile services
Cnam azure 2014 mobile services
 
WebSocket JSON Hackday
WebSocket JSON HackdayWebSocket JSON Hackday
WebSocket JSON Hackday
 
Web 11 | AJAX + JSON + PHP
Web 11 | AJAX + JSON + PHPWeb 11 | AJAX + JSON + PHP
Web 11 | AJAX + JSON + PHP
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-future
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天
 
Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of today
 
Ajax for dummies, and not only.
Ajax for dummies, and not only.Ajax for dummies, and not only.
Ajax for dummies, and not only.
 

Plus de Michael Galpin

Plus de Michael Galpin (12)

Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in school
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and Smartphones
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Scala on Android: Experiences at Bump Technologies
Scala on Android: Experiences at Bump TechnologiesScala on Android: Experiences at Bump Technologies
Scala on Android: Experiences at Bump Technologies
 
That’s My App - Running in Your Background - Draining Your Battery
That’s My App - Running in Your Background - Draining Your BatteryThat’s My App - Running in Your Background - Draining Your Battery
That’s My App - Running in Your Background - Draining Your Battery
 
Persistent Data Structures And Managed References
Persistent Data Structures And Managed ReferencesPersistent Data Structures And Managed References
Persistent Data Structures And Managed References
 
Scala on Your Phone
Scala on Your PhoneScala on Your Phone
Scala on Your Phone
 
Mobile Development 101
Mobile Development 101Mobile Development 101
Mobile Development 101
 
RIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWTRIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWT
 
Eclipse @eBay 2009
Eclipse @eBay 2009Eclipse @eBay 2009
Eclipse @eBay 2009
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
 
Eclipse@eBay
Eclipse@eBayEclipse@eBay
Eclipse@eBay
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Mobile Web 5.0

  • 2. WHO AM I? Michael Galpin Mobile Architect, eBay Android & Mobile Web Author, Android in Practice @michaelg
  • 4. Mobile is the new HOTness
  • 5. MO BILE W E B THE IPHONE MYTH
  • 6. MO BILE 2 BIRDS, 1 STONE? W E B
  • 7. MO BILE ONE WEBKIT TO W E B RULE THEM ALL?
  • 8. MO BILE ONE WEBKIT TO W E B RULE THEM ALL? Android 2.2.1 iOS 4.1
  • 9. MOBILE PARTY LIKE IT’S W E B 2022
  • 10. WHAT?
  • 13. HTML
  • 14. JavaScript HTML CSS 3.0
  • 15. MO BILE JUST ADD W E B VIEWPORT?
  • 16. HOW?
  • 17. MO BILE W E B GEOLOCATION geocoder = new google.maps.Geocoder(); if (navigator.geolocation){ var gps = navigator.geolocation; gps.getCurrentPosition(function(pos){ var latLng = new google.maps.LatLng(pos.coords.latitude,pos.coords.longitude); var opts = {zoom:12, center:latLng, mapTypeId: google.maps.MapTypeId.ROADMAP}; map = new google.maps.Map($("map_canvas"), opts); theUser = new google.maps.Marker({ position: latLng, map: map, title: "You!" }); }); trackerId = gps.watchPosition(function(pos){ var latLng = new google.maps.LatLng(pos.coords.latitude,pos.coords.longitude); map.setCenter(latLng); theUser.setPosition(latLng); }); }
  • 18. MO BILE W E B GEOLOCATION OS/Browser Status/Version 3.0 2.0 6.0 X X
  • 19. MO BILE W E B DOM STORAGE if (window.localStorage){ localStorage.setItem("tweet" + tweet.id, JSON.stringify(tweet)); var index = localStorage.getItem("index::" + keyword); if (index){ index = JSON.parse(index); } else { index = []; } index.push(tweet.id); localStorage.setItem("index::"+keyword, JSON.stringify(index)); }
  • 20. MO BILE W E B DOM STORAGE if (window.localStorage){ localStorage.setItem("tweet" + tweet.id, JSON.stringify(tweet)); var index = localStorage.getItem("index::" + keyword); if (index){ index = JSON.parse(index); } else { index = []; } index.push(tweet.id); localStorage.setItem("index::"+keyword, JSON.stringify(index)); }
  • 21. MO BILE W E B DOM STORAGE OS/Browser Status/Version 3.0 2.0 6.0 7.0 X
  • 22. MO BILE W E B WEB WORKERS var worker = new Worker("details.js"); worker.onmessage = function(message){ var responseXmlStr = message.data.responseXml; var itemDetails = parseFromXml(responseXmlStr); if (window.localStorage){ localStorage.setItem(itemDetails.id, responseXmlStr); } dealDetails[itemDetails.id] = itemDetails; }; worker.postMessage(item.itemId); onmessage = function(message){ var itemId = message.data; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if (this.readyState == 4 && this.status == 200){ postMessage({responseXml: this.responseText}); } }; var urlStr = generateUrl(itemId); xhr.open("GET", "proxy?url=" + escape(urlStr)); xhr.send(null); }
  • 23. MO BILE W E B WEB WORKERS OS/Browser Status/Version X 2.0 6.0 X X
  • 24. MO BILE W E B WEBSOCKET if (window.WebSocket){ var conn = new WebSocket("ws://my.server.com/socket"); conn.onopen = function(){ setStatusMessage('connecting...'); conn.send('connect'); }; conn.onmessage = function(msg){ setStatusMessage('connected'); updateItemStatus(JSON.parse(msg.data)); }; a at conn.onerror = function(err){ D showError(err); conn.close(); }; conn.onclose = function(evt){ setStatusMessage('connection closed'); }; }
  • 25. MO BILE W E B WEBSOCKET OS/Browser Status/Version 4.2b X X X X
  • 26. MOBILE W E B CANVAS var ctx = $("graph").getContext("2d"); ctx.font = "bold 12px sans-serif"; ctx.textAlign = "start"; for (i=0;i<data.length;i++){ ctx.fillStyle = "rgba(0, 0, 200, 0.9)"; ctx.fillRect(x, maxHeight - (data[i][report.y] / 2), width, (data[i][report.y] / 2)); ctx.fillStyle = "rgba(0, 0, 0, 0.9)"; ctx.fillText(data[i][report.x], x + (width / 4), maxHeight + 15); x += width + buffer; } ctx.moveTo(axisBuffer, maxHeight); ctx.lineTo(axisBuffer+maxWidth, maxHeight); ctx.strokeStyle = "black"; ctx.stroke(); ctx.moveTo(axisBuffer,0); ctx.lineTo(axisBuffer,maxHeight); ctx.stroke();
  • 27. MO BILE W E B CANVAS OS/Browser Status/Version 1.0 1.0 6.0 X v2
  • 28. MOBILE W E B CSS 3.0 $("formSection").style["-webkit-transform"] = "rotateZ(-5deg)"; $("formSection").style["-webkit-transition"] = "-webkit-transform 2s ease-in-out"; $("rtBtn").innerHTML = "Undo"; $("rtBtn").onclick = function() { $("formSection").style["-webkit-transform"] = ""; $("rtBtn").innerHTML = "Rotate"; $("rtBtn").setAttribute("onclick", "rotate()"); }
  • 29. MORE CSS 3.0 .abc { tr:nth-child(4n+1) { color: navy; } border: 1px solid #000; tr:nth-child(4n+2) { color: green; } border-radius: 9px; tr:nth-child(4n+3) { color: maroon; } -webkit-column-count:4; tr:nth-child(4n+4) { color: purple; } -webkit-column-rule: 1px solid #a00; header > h1{ -webkit-column-gap: 0.75em; color: yellow; } background: -webkit-gradient(linear, left top, h2 { left bottom, from(blue), to(white)) -webkit-text-fill-color: blue; } -webkit-text-stroke-color: yellow; .xyz{ -webkit-text-stroke-width: 1.5px; text-shadow: #6374AB 4px -4px 2px; background: -webkit-gradient(radial, 430 50, 0, overflow: hidden; 430 50, 200, from(red), to(#000)); text-overflow: ellipsis; -webkit-box-reflect:below 5px -webkit-gradient( border: 1px solid #bbb; linear, left top, left bottom, border-radius: 9px; from(transparent), background-color: #fff; color-stop(0.5, transparent), to(white)); } }
  • 30. MO BILE W E B CSS 3.0 OS/Browser Status/Version 3.0 2.0 X X X
  • 31. MO BILE APPLICATION W E B CACHE <!DOCTYPE html> <html manifest="manifest.mf"> <head> <!-- ... --> </head> <body> <!-- ... --> </body> </html> CACHE MANIFEST # Version 0.2 CACHE: offline.html json2.js /images/gym.jpg /images/soccer.jpg /images/online.jpg NETWORK: http://search.twitter.com/
  • 32. MO BILE W E B APPLICATION OS/Browser Status/Version 2.0 2.0 6.0 X X
  • 33. DEVICE MOBILE W E B if (navigator.device.captureImage){ device.captureImage(function(data){ var file = data[0]; var xhr = new XMLHttpRequest(); xhr.upload.addEventListener("progress", function(e) { if (e.lengthComputable) { var percentage = Math.round((e.loaded * 100) / e.total); updateStatusBar(percentage); } }, false); xhr.open("POST", "http://my.server.com/upload"); xhr.overrideMimeType('text/plain; charset=x-user-defined-binary'); xhr.sendAsBinary(file.getAsBinary()); }); }
  • 34. MO BILE W E B DEVICE OS/Browser Status/Version X 3.0 X X X
  • 35. MO BILE W E B TOUCH EVENTS logo.ontouchmove = function(event){ if (event.touches.length == 1){ event.preventDefault(); var touch = event.touches[0]; var node = touch.target; node.style.position = "absolute"; node.style.left = touch.pageX + "px"; node.style.top = touch.pageY + "px"; } } var angle = 0; logo.ongesturechange = function(event){ var node = event.target; node.style.webkitTransform = "rotate("+ ((angle + event.rotation) % 360)+"deg)"; } logo.ongestureend = function(event){ angle = (angle + event.rotation) % 360; }
  • 36. MO BILE W E B TOUCH EVENTS OS/Browser Status/Version 2.0 1.0 6.0? X X
  • 37. MO BILE W E B AUDIO/VIDEO <video controls="controls" preload="true" width="720" height="640"> <source src="feature.ogg" type="video/ogg" /> <source src="feature.mp4" type="video/mp4" /> Your browser sucks </video>
  • 38. MO BILE W E B AUDIO/VIDEO OS/Browser Status/Version 1.0 2.0 X X X
  • 39. MO BILE W E B META <meta name="viewport" content="width=device-width; user- scalable=no;"/> <meta name="apple-touch-fullscreen" content="YES" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <link rel="apple-touch-icon" href="rice-and-bones.png"/>
  • 41. MOBILE BEST W E B PRACTICES • Servers are for data • Orientation matters • Cache, cache, cache • Frameworks (not really mobile): SproutCore, Cappuccino • Frameworks (mobile): Sencha, jQTouch