SlideShare a Scribd company logo
Mobile
HTML, CSS, JavaScript
       David Calhoun
Mobile HTML, CSS, and JavaScript
Viewport Meta Tag




   :(        :)
Viewport Meta Tag

<meta name="viewport"
content="width=device-width"/>
URI Schemes




href="sms:18005555555"   href="tel:18005555555"
Home Screen Icon




          Android too!
Home Screen Icon

<link rel="apple-touch-icon"
href="icon.png"/>
Full Screen Flag (iOS)


         vs
Full Screen Flag (iOS)


<meta name="apple-mobile-web-
app-capable" content="yes"/>
Splash Screen (iOS)
       <link rel="apple-touch-
       startup-image"
       href="startup.png"/>
Status Bar Style
Default         Black
Status Bar Style

<meta name="apple-mobile-web-
app-status-bar-style"
content="black"/>
<input type=”search”>
<input type=”tel”>
<input type=”email”>
Media Capture




                3.0
Media Capture

• Opens straight to the camera or
  microphone for file input




                                    3.0
Media Capture

 • Opens straight to the camera or
    microphone for file input

<input type="file" accept="image/*;capture=camera"/>




                                                       3.0
Media Capture

 • Opens straight to the camera or
    microphone for file input

<input type="file" accept="image/*;capture=camera"/>
<input type="file" accept="video/*;capture=camcorder"/>




                                                          3.0
Media Capture

 • Opens straight to the camera or
    microphone for file input

<input type="file" accept="image/*;capture=camera"/>
<input type="file" accept="video/*;capture=camcorder"/>
<input type="file" accept="audio/*;capture=microphone"/>




                                                           3.0
The Joys of Autocorrect
Controlling autocorrect
<input autocorrect="off"
autocomplete="off"
autocapitalize="off"/>
Mobile HTML, CSS, and JavaScript
Media Queries

• based on screen size and device size
• based on orientation
• based on screen resolution
• etc...
Media Queries
@media   all and (max-width: 480px) {
  body   { }
}
@media   all and (max-device-width: 480px) { }
@media   all and (orientation: portrait) { }
tap-highlight-color
        .no-highlight {
          -webkit-tap-highlight-color:
        transparent;
        }

        .red-highlight {
          -webkit-tap-highlight-color:
        red;
        }
user-select

     .no-user-select {
       -webkit-user-select: none;
       -moz-user-select: none;
       user-select: none;
     }




                      ?
touch-callout

                   .no-callout {
                     -webkit-touch-callout:
                   none;
                   }




Default behavior
JavaScript
Touch Events

         • touchstart
         • touchmove
         • touchend
         • (touchcancel)
Touch Events
document.addEventListener('touchstart',
function(e){
  //e.touches
  //e.changedTouches
}, false);




http://frontendstuff.com/javascript/examples/touch.html
Gesture Events (iOS)

            • iOS only
            • 2+ fingers
            • gesturestart
            • gesturechange
            • gestureend
Gesture Events (iOS)
  document.addEventListener('gesturestart',
  function(e){
    //e.scale
    //e.rotation
  }, false);




http://frontendstuff.com/javascript/examples/gesture.html
orientationchange
// fired every 90 degrees of rotation
window.addEventListener('orientationchange',
function(e){
  //window.orientation (0 is portrait, 90 and
-90 are landscape)
}, false);
deviceorientation
   • taps into the gyroscope
   • not just every 90 degrees



                                                  3.0       4.2
http://frontendstuff.com/javascript/examples/deviceorientation.html
deviceorientation

// fired a LOT
window.addEventListener('deviceorientation', function(e){
  //e.alpha;
  //e.beta;
  //e.gamma;
}, false);
devicemotion
                                         • taps into accelerometer
                                         • practical application: shake
                                              gesture?




                                                                3.0           4.2
http://developer.apple.com/library/safari/#documentation/SafariDOMAdditions/Reference/
        DeviceMotionEventClassRef/DeviceMotionEvent/DeviceMotionEvent.html
devicemotion
 window.addEventListener('devicemotion', function (e){
   // e.accelerationIncludingGravity.x
   // e.accelerationIncludingGravity.y
   // e.accelerationIncludingGravity.z
 }, false);




http://frontendstuff.com/javascript/examples/devicemotion.html
window.devicePixelRatio
window.devicePixelRatio


• 1.5 (Nexus One, etc.)
• 2 (iPhone 4, etc.)
navigator.connection
     (Android)
  {
      "type": "3",
      "UNKNOWN": "0",
      "ETHERNET": "1",
      "WIFI": "2",
      "CELL_2G": "3",
      "CELL_3G": "4"
  }                      2.2
navigator.connection
       (Android)

navigator.connection.CELL_3G
navigator.connection.CELL_2G
navigator.connection.WIFI
Mobile JavaScript Libraries




                       and much more...

  http://davidbcalhoun.com/2010/mobile-javascript-libraries-and-frameworks
Photo Credits
   •   http://www.flickr.com/photos/kk/106960641/

   •   http://www.flickr.com/photos/geirarne/110995239/

   •   http://www.flickr.com/photos/aldrin_muya/3133715902/

   •   http://crockfordfacts.com/

   •   http://www.flickr.com/photos/equanimity/535648833/

   •   http://www.flickr.com/photos/71518947@N00/4698968858/
That’s All Folks!
• Twitter: @franksvalli
• SpeakerRate: http://bit.ly/hMEEfo

More Related Content

PPT
WordPress and Ajax
PDF
Ajax Security
PDF
jQuery Proven Performance Tips & Tricks
PPT
High Performance Ajax Applications
PDF
How to make Ajax work for you
PPTX
Maintainable JavaScript 2012
PPTX
jQuery from the very beginning
PDF
SocketStream
WordPress and Ajax
Ajax Security
jQuery Proven Performance Tips & Tricks
High Performance Ajax Applications
How to make Ajax work for you
Maintainable JavaScript 2012
jQuery from the very beginning
SocketStream

What's hot (20)

PDF
Design patterns revisited with PHP 5.3
PDF
Building Web Sites that Work Everywhere
PPTX
High Performance JavaScript (CapitolJS 2011)
PDF
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
PDF
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
PDF
Building scalable applications with angular js
KEY
jQuery Anti-Patterns for Performance & Compression
PDF
Bootstrap과 UI-Bootstrap
PDF
Angular or Backbone: Go Mobile!
KEY
the 5 layers of web accessibility - Open Web Camp II
PDF
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
PDF
Building a Startup Stack with AngularJS
PDF
The DOM is a Mess @ Yahoo
PDF
Dan Webb Presentation
PPTX
JavaScript Presentation Frameworks and Libraries
PDF
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
PDF
Enjoy the vue.js
PDF
HTML5: where flash isn't needed anymore
PDF
HTML5 and the dawn of rich mobile web applications pt 1
PPT
Symfony2 and AngularJS
Design patterns revisited with PHP 5.3
Building Web Sites that Work Everywhere
High Performance JavaScript (CapitolJS 2011)
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Building scalable applications with angular js
jQuery Anti-Patterns for Performance & Compression
Bootstrap과 UI-Bootstrap
Angular or Backbone: Go Mobile!
the 5 layers of web accessibility - Open Web Camp II
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Building a Startup Stack with AngularJS
The DOM is a Mess @ Yahoo
Dan Webb Presentation
JavaScript Presentation Frameworks and Libraries
Getting touchy - an introduction to touch events / Web Standards Days / Mosco...
Enjoy the vue.js
HTML5: where flash isn't needed anymore
HTML5 and the dawn of rich mobile web applications pt 1
Symfony2 and AngularJS
Ad

Viewers also liked (20)

PPTX
Understanding & Designing for the Mobile Web
PPTX
The Mobile Inbox 201: Design & Coding
PPT
Web 2 sms corporate
PDF
Kullanilabilirlik Sözlüğü
PPTX
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
PDF
HRA Coalition Letter (June 15, 2016)
PDF
Refactoring out of the mess
PDF
ES6Katas.org - an introduction and the story behind
PPT
завуч и директор
PPTX
Presentationfor lnl
PDF
Frontend Engineer Toolbox
PPTX
САЙТ ГИМНАЗИИ
PPTX
Kontseptsiya nova shkola
PDF
Hard-Won Lessons In Responsive Email Design - SmashingConf Oxford 2014
PDF
02 JavaScript Syntax
PPT
Context Switching
PPTX
Arquitectura protoracionalista
PPTX
43 Inspirational Mobile Splash Screens
PDF
Mobile html5 today
PPTX
System Analysis and Design Proposal presentation
Understanding & Designing for the Mobile Web
The Mobile Inbox 201: Design & Coding
Web 2 sms corporate
Kullanilabilirlik Sözlüğü
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
HRA Coalition Letter (June 15, 2016)
Refactoring out of the mess
ES6Katas.org - an introduction and the story behind
завуч и директор
Presentationfor lnl
Frontend Engineer Toolbox
САЙТ ГИМНАЗИИ
Kontseptsiya nova shkola
Hard-Won Lessons In Responsive Email Design - SmashingConf Oxford 2014
02 JavaScript Syntax
Context Switching
Arquitectura protoracionalista
43 Inspirational Mobile Splash Screens
Mobile html5 today
System Analysis and Design Proposal presentation
Ad

Similar to Mobile HTML, CSS, and JavaScript (20)

PDF
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
PPTX
HTML5 on Mobile
PDF
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
PDF
Web APIs & Apps - Mozilla
PDF
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
KEY
Intro To webOS
PDF
WebAPIs & Apps - Mozilla London
PPTX
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
PDF
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
PPTX
Academy PRO: HTML5 API multimedia
PDF
Adaptive Layouts - standards>next London 28.05.2011
PDF
JavaScript APIs - The Web is the Platform
PDF
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
PDF
The Death of a Mouse
PDF
Making your site mobile-friendly - DevCSI Reading 21.07.2010
PPTX
Windows Store app using XAML and C#: Enterprise Product Development
PDF
Web versus Native: round 1!
PDF
Sperimentazioni lezione6 from_designtoapplication copy
KEY
Fake it 'til you make it
PDF
Chris Wilson: Progressive Web Apps
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
HTML5 on Mobile
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Web APIs & Apps - Mozilla
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
Intro To webOS
WebAPIs & Apps - Mozilla London
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
Academy PRO: HTML5 API multimedia
Adaptive Layouts - standards>next London 28.05.2011
JavaScript APIs - The Web is the Platform
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
The Death of a Mouse
Making your site mobile-friendly - DevCSI Reading 21.07.2010
Windows Store app using XAML and C#: Enterprise Product Development
Web versus Native: round 1!
Sperimentazioni lezione6 from_designtoapplication copy
Fake it 'til you make it
Chris Wilson: Progressive Web Apps

Mobile HTML, CSS, and JavaScript

Editor's Notes