SlideShare une entreprise Scribd logo
1  sur  50
Télécharger pour lire hors ligne
Coding Tips You Should Know Before Distributing
Your HTML5 Web App on Mobile Devices
Russell Beattie, Amazon
November 15, 2013

© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc.
Friday, November 15, 13
Agenda
• Welcome
• HTML5 Mobile Web App Basics
• Setup
• DevTools Demo

• Coding Tips and Best Practices
•
•
•
•

HTML
CSS
Javascript
Offline

Friday, November 15, 13
HTML5 Mobile
Web App Basics

Friday, November 15, 13
Setup
• Text Editor
• Modern Desktop Browser
• Chrome, Firefox, Safari, IE 11, etc.

• Modern Mobile Browser or Tester
• Amazon Web App Tester, Chrome, etc.

• Android SDK
• For remote debugging

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
Basic HTML5 Web App Template
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Template</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<style>
html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF}
</style>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div id="content"></div>
<script src="main.js"></script>
</body>
</html>

Friday, November 15, 13
DevTools Demo
• Connecting (via WebSockets or TCP/IP)
• Live modification of page (CSS, HTML)
• Interaction with device via inspection button
• Debugging (JavaScript, Network, etc.)
• Frame-rate / GPU
• Profiling

Friday, November 15, 13
Coding Tips and
Best Practices

Friday, November 15, 13
HTML

Friday, November 15, 13
Headers - Apple
<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">
<meta name="apple-mobile-web-app-title" content="UVM Home">
<link rel="apple-touch-startup-image" href="/startup.png">
<link rel="apple-touch-icon" sizes="128x128" href="niceicon.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/touch/apple-touchicon-144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="img/touch/apple-touch-icon-57x57precomposed.png">
<link rel="shortcut icon" href="img/touch/apple-touch-icon.png">

Friday, November 15, 13
Headers - Google, Blackberry, Microsoft
<!-- Google -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" sizes="196x196" href="nice-highres.png">
<link rel="shortcut icon" sizes="128x128" href="niceicon.png">
<!-- Blackberry -->
<meta name="HandheldFriendly" content="true">
<meta name="cursor-event-mode" value="native">
<meta http-equiv="x-rim-auto-match" content="none">
<!-- Microsoft -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="cleartype" content="on">
<meta name="msapplication-TileImage" content="pics/logowin8pin.png"/>
<meta name="msapplication-TileColor" content="#B20099"/>
<meta name="msapplication-badge" value="frequency=1440;polling-uri=http://
www.example.com/Win8TileNotification.php" />

Friday, November 15, 13
Headers - Firefox, W3C, etc.
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
<link rel="shortcut icon" href="favicon.ico" />
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="address=no"/>
<link rel="dns-prefetch" href="page2.html">
<meta name="description" content=""/>
<meta name="keywords" content=""/>

Friday, November 15, 13
Input Field Types
<form>
Date: <input type="date" value="2013-09-03" name="dateInput">
Datetime: <input type="datetime" name="datetimeInput">
Datetime-local:
<input type="datetime-local" value="2013-09-03T20:00" name="datetime-local">
Email: <input type="email" name="emailInput">
Month: <input type="month" value="2013-09" name="monthInput">
Number: <input type="number" name="numberInput">
Password: <input type="password" name="passwordInput">
Range: <input type="range" name="rangeInput">
Search: <input type="search" name="searchInput">
Tel: <input type="tel" name="telInput">
Time: <input type="time" name="timeInput">
Url: <input type="url" name="urlInput">
</form>

Friday, November 15, 13
Required and Validation
<input type="url" name="urlInput" required pattern="https?://.+">
...
input:required:invalid, input:focus:invalid {
background-image: url(/images/invalid.png);
background-position: right top;
background-repeat: no-repeat;
}
input:required:valid {
background-image: url(/images/valid.png);
background-position: right top;
background-repeat: no-repeat;
}

Friday, November 15, 13
CSS

Friday, November 15, 13
Interaction
html {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-user-select: none;
}
body{
-webkit-font-smoothing: antialiased; /* Fix for webkit rendering */
-webkit-text-size-adjust: 100%;
}
/* don't let "actions" dialog to come up when element is touch/held */
.prevent-action {
-webkit-touch-callout: none;
}

Friday, November 15, 13
Interaction continued
/* no dragging of element at all */
.content p.no-drag {
-webkit-user-drag: none;
}
/* drags entire element, not the text/selection */
.sidebar div.element-drag {
-webkit-user-drag: element;
}
/* change the character used to hide user passwords */
input[type="password"] {
-webkit-text-security: square;
}
textarea[contenteditable] {
-webkit-appearance: none;
}

Friday, November 15, 13
Hardware acceleration
/* position */
-webkit-transform: translate(0, 0);
-webkit-transform: translateZ(0);
-webkit-transform: translate3d(0, 0, 0);
/* scale */
-webkit-transform: scale(0);
/* rotation */
-webkit-transform: rotate(0);
/* opacity */
opacity: 0.5;

Friday, November 15, 13
Animations
@-webkit-keyframes pulse {
from {
-webkit-transform: scale(.1);
}
to {
-webkit-transform: scale(1);
}
}
div {
-webkit-animation-name: pulse;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-direction: alternate;
}
// Javascript
content.addEventListener("webkitAnimationIteration", countAnims, false);

Friday, November 15, 13
Transitions
// CSS
.box {
left: 40px;
-webkit-transition: all 0.3s ease-out;
}
div.box.totheleft {
-webkit-transform: translate3d(0, 0, 0);
}
div.box.totheright {
-webkit-transform: translate3d(80px, 0, 0);
}
// Javascript
window.addEventListener("webkitTransitionEnd", function() {
// Handle the end of the transition
}, false);

Friday, November 15, 13
Media Queries
@media screen and (orientation:portrait) {
/* portrait-specific styles */
}
@media screen and (orientation:landscape) {
/* landscape-specific styles */
}
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (minresolution: 144dpi) {
/* Style adjustments for viewports that meet the condition */
}

Friday, November 15, 13
JavaScript

Friday, November 15, 13
Orientation Detection
var mql = window.matchMedia("(orientation: portrait)");
if(mql.matches) {
// Portrait orientation
} else {
// Landscape orientation
}
mql.addListener(function(m) {
if(m.matches) {
// Changed to portrait
} else {
// Changed to landscape
}
});
// Resizing
window.addEventListener("resize", function() {
// window.innerHeight > window.innerWidth ...
}, false);

Friday, November 15, 13
Device Resolution
var meta = document.createElement("meta");
meta.setAttribute('name','viewport');
var content = 'initial-scale=';
content += 1 / window.devicePixelRatio;
content += ',user-scalable=no';
meta.setAttribute('content', content);
document.getElementsByTagName('head')[0].appendChild(meta);

Friday, November 15, 13
Canvas pre-rendering
// no pre-rendering
function render() {
drawSpaceShip(context);
requestAnimationFrame(render);
}
// pre-rendering
var sprite = document.createElement('canvas');
sprite.width = 64;
sprite.height = 64;
var spriteCtx = sprite.getContext('2d');
drawSpaceShip(spriteCtx);
function render() {
context.drawImage(sprite, 0, 0);
requestAnimationFrame(render);
}

Friday, November 15, 13
Canvas batch calls
// Slower
for (var i = 0; i < points.length - 1; i++) {
var p1 = points[i];
var p2 = points[i+1];
context.beginPath();
context.moveTo(p1.x, p1.y);
context.lineTo(p2.x, p2.y);
context.stroke();
}
// Faster
context.beginPath();
for (var i = 0; i < points.length - 1; i++) {
var p1 = points[i];
var p2 = points[i+1];
context.moveTo(p1.x, p1.y);
context.lineTo(p2.x, p2.y);
}
context.stroke();

Friday, November 15, 13
Canvas Redraw Regions
// redraw entire canvas
context.fillRect(0, 0, canvas.width, canvas.height);
// redraw only 'dirty' areas
context.fillRect(last.x, last.y, last.width, last.height);
// faster way to redraw canvas
context.clearRect(0, 0, canvas.width, canvas.height)

Friday, November 15, 13
RequestAnimationFrame
function animate(time){
//random drawing
context.clearRect(0, 0, canvas.width, canvas.height);
context.beginPath();
context.rect(x, y, 50, 50);
context.fillStyle = '#8ED6FF';
context.fill();
// Old way:
// window.setTimeout(animate, 1000/60);
// New way:
window.requestAnimationFrame(animate);
}

Friday, November 15, 13
Reflows and repaints
var bstyle = document.body.style; // cache
bstyle.padding = "20px"; // reflow, repaint
bstyle.border = "10px solid red"; // another reflow and a repaint
bstyle.color = "blue"; // repaint only, no dimensions changed
bstyle.backgroundColor = "#fad"; // repaint
bstyle.fontSize = "2em"; // reflow, repaint
// new DOM element - reflow, repaint
document.body.appendChild(document.createTextNode('hello...'));

Friday, November 15, 13
Minimize dimension or location queries
// Slower
var elem = document.getElementById('animated');
elem.style.fontSize = (elem.offsetWidth / 10) + 'px';
elem.firstChild.style.marginleft = (elem.offsetWidth / 20) + 'px';
// Faster
var elem = document.getElementById('animated'),
elemWidth = elem.offsetWidth;
elem.style.fontSize = (elemWidth / 10) + 'px';
elem.firstChild.style.marginleft = (elemWidth / 20) + 'px';

Friday, November 15, 13
Debounce Events
function SomeObject() {
var self = this;
this.lastExecThrottle = 500; // limit to one call every "n" msec
this.lastExec = new Date();
this.timer = null;
this.resizeHandler = function() {
var d = new Date();
if (d-self.lastExec < self.lastExecThrottle) {
if (self.timer) {
window.clearTimeout(self.timer);
}
self.timer = window.setTimeout(self.resizeHandler, self.lastExecThrottle);
return false; // exit
}
self.lastExec = d; // update "last exec" time
self.callResizeHandlerFunctions();
}
}
var someObject = new SomeObject();
window.onresize = someObject.resizeHandler;

Friday, November 15, 13
Offline

Friday, November 15, 13
Server MIME Types
AddType text/cache-manifest .manifest
AddType text/cache-manifest .appcache
AddType application/x-web-app-manifest+json .webapp

Friday, November 15, 13
App cache manifest
CACHE MANIFEST
# Version 1.0
# filename: app.manifest or name.appcache
CACHE:
index.html
Game-Break.mp3
Game-Death.mp3
Game-Shot.mp3
Game-Spawn.mp3
main.js
main.css
three.min.js
...
<html manifest="app.manifest">

Friday, November 15, 13
W3C Web App Manifest
{
"name": "Flip.io",
"description": "Flip.io - 999 Word Puzzles. A simple, yet challenging word puzzle that
will entertain novices and lexicographers alike. Presented with 10 word definitions and
scrambled tiles of letter combos, can you find all the words?",
"launch_path": "/",
"icons": {
"60": "/flip60.png",
"128": "/flip128.png"
},
"developer": {
"name": "Russell Beattie",
"url": "http://flip.io"
},
"default_locale": "en",
"fullscreen": "true"
}

Friday, November 15, 13
Amazon Mobile Web App Platform Manifest
{
"verification_key": "insert your verification key from the App File(s) tab",
"launch_path": "index.html",
"permissions": [
"iap",
"geolocation",
"auth"
],
"type": "web",
"version": "0.1a",
"last_update": "2013-04-08 13:30:00-0800",
"created_by": "webappdev"
}

Friday, November 15, 13
Real World App Demo

Friday, November 15, 13
Please give us your feedback on this
presentation

MBL301
As a thank you, we will select prize
winners daily for completed surveys!

Thank You

@RussB • beattier@amazon.com

developer.amazon.com/webapps
Friday, November 15, 13

Contenu connexe

En vedette

OnConnectionLost: The life of an offline web application - JSUnconf 2015
OnConnectionLost: The life of an offline web application - JSUnconf 2015OnConnectionLost: The life of an offline web application - JSUnconf 2015
OnConnectionLost: The life of an offline web application - JSUnconf 2015Johannes Thönes
 
HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?Remy Sharp
 
Updated: NW.js - Desktop Apps with Javascript
Updated: NW.js - Desktop Apps with JavascriptUpdated: NW.js - Desktop Apps with Javascript
Updated: NW.js - Desktop Apps with JavascriptRalf Schwoebel
 
Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13Stephan Hochdörfer
 
From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?Sergii Zhuk
 
Anatomy of mobile App development
Anatomy of mobile App developmentAnatomy of mobile App development
Anatomy of mobile App developmentRalf Schwoebel
 
Presentación html5
Presentación html5Presentación html5
Presentación html5aydimdagam
 
HTML5 Offline Web Application
HTML5 Offline Web ApplicationHTML5 Offline Web Application
HTML5 Offline Web ApplicationAllan Huang
 
GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013
GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013
GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013Amazon Web Services
 
Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8Stephan Hochdörfer
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)robinzimmermann
 
HTML5 AppCache: The Manifest
HTML5 AppCache: The ManifestHTML5 AppCache: The Manifest
HTML5 AppCache: The ManifestRalf Schwoebel
 
Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013
Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013
Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013Amazon Web Services
 
Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app Ivano Malavolta
 
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013Amazon Web Services
 
Html5 Offline Applications
Html5 Offline Applications Html5 Offline Applications
Html5 Offline Applications Sunny Sharma
 
Content Management and Running your Website on AWS
Content Management and Running your Website on AWSContent Management and Running your Website on AWS
Content Management and Running your Website on AWSAmazon Web Services
 

En vedette (17)

OnConnectionLost: The life of an offline web application - JSUnconf 2015
OnConnectionLost: The life of an offline web application - JSUnconf 2015OnConnectionLost: The life of an offline web application - JSUnconf 2015
OnConnectionLost: The life of an offline web application - JSUnconf 2015
 
HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?
 
Updated: NW.js - Desktop Apps with Javascript
Updated: NW.js - Desktop Apps with JavascriptUpdated: NW.js - Desktop Apps with Javascript
Updated: NW.js - Desktop Apps with Javascript
 
Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13Offline Strategies for HTML5 Web Applications - oscon13
Offline Strategies for HTML5 Web Applications - oscon13
 
From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?From JavaEE to Android: Way in one click?
From JavaEE to Android: Way in one click?
 
Anatomy of mobile App development
Anatomy of mobile App developmentAnatomy of mobile App development
Anatomy of mobile App development
 
Presentación html5
Presentación html5Presentación html5
Presentación html5
 
HTML5 Offline Web Application
HTML5 Offline Web ApplicationHTML5 Offline Web Application
HTML5 Offline Web Application
 
GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013
GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013
GraphLab: Large-Scale Machine Learning on Graphs (BDT204) | AWS re:Invent 2013
 
Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8Offline strategies for HTML5 web applications - frOSCon8
Offline strategies for HTML5 web applications - frOSCon8
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)
 
HTML5 AppCache: The Manifest
HTML5 AppCache: The ManifestHTML5 AppCache: The Manifest
HTML5 AppCache: The Manifest
 
Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013
Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013
Data Science at Netflix with Amazon EMR (BDT306) | AWS re:Invent 2013
 
Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app
 
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
Getting Maximum Performance from Amazon Redshift (DAT305) | AWS re:Invent 2013
 
Html5 Offline Applications
Html5 Offline Applications Html5 Offline Applications
Html5 Offline Applications
 
Content Management and Running your Website on AWS
Content Management and Running your Website on AWSContent Management and Running your Website on AWS
Content Management and Running your Website on AWS
 

Plus de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Dernier

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 businesspanagenda
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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 TerraformAndrey Devyatkin
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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 DiscoveryTrustArc
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Dernier (20)

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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Tips You Should Know Before Distributing Your HTML5 Web App on Mobile (MBL301) | AWS re:Invent 2013

  • 1. Coding Tips You Should Know Before Distributing Your HTML5 Web App on Mobile Devices Russell Beattie, Amazon November 15, 2013 © 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc. Friday, November 15, 13
  • 2. Agenda • Welcome • HTML5 Mobile Web App Basics • Setup • DevTools Demo • Coding Tips and Best Practices • • • • HTML CSS Javascript Offline Friday, November 15, 13
  • 3. HTML5 Mobile Web App Basics Friday, November 15, 13
  • 4. Setup • Text Editor • Modern Desktop Browser • Chrome, Firefox, Safari, IE 11, etc. • Modern Mobile Browser or Tester • Amazon Web App Tester, Chrome, etc. • Android SDK • For remote debugging Friday, November 15, 13
  • 5. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 6. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 7. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 8. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 9. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 10. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 11. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 12. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 13. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 14. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 15. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 16. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 17. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 18. Basic HTML5 Web App Template <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Template</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <style> html, body {height: 100%; margin: 0; padding: 0; background: #000; color: #FFF} </style> <link rel="stylesheet" href="main.css"> </head> <body> <div id="content"></div> <script src="main.js"></script> </body> </html> Friday, November 15, 13
  • 19. DevTools Demo • Connecting (via WebSockets or TCP/IP) • Live modification of page (CSS, HTML) • Interaction with device via inspection button • Debugging (JavaScript, Network, etc.) • Frame-rate / GPU • Profiling Friday, November 15, 13
  • 20. Coding Tips and Best Practices Friday, November 15, 13
  • 22. Headers - Apple <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"> <meta name="apple-mobile-web-app-title" content="UVM Home"> <link rel="apple-touch-startup-image" href="/startup.png"> <link rel="apple-touch-icon" sizes="128x128" href="niceicon.png"> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/touch/apple-touchicon-144x144-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="img/touch/apple-touch-icon-57x57precomposed.png"> <link rel="shortcut icon" href="img/touch/apple-touch-icon.png"> Friday, November 15, 13
  • 23. Headers - Google, Blackberry, Microsoft <!-- Google --> <meta name="mobile-web-app-capable" content="yes"> <link rel="shortcut icon" sizes="196x196" href="nice-highres.png"> <link rel="shortcut icon" sizes="128x128" href="niceicon.png"> <!-- Blackberry --> <meta name="HandheldFriendly" content="true"> <meta name="cursor-event-mode" value="native"> <meta http-equiv="x-rim-auto-match" content="none"> <!-- Microsoft --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="cleartype" content="on"> <meta name="msapplication-TileImage" content="pics/logowin8pin.png"/> <meta name="msapplication-TileColor" content="#B20099"/> <meta name="msapplication-badge" value="frequency=1440;polling-uri=http:// www.example.com/Win8TileNotification.php" /> Friday, November 15, 13
  • 24. Headers - Firefox, W3C, etc. <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/> <link rel="shortcut icon" href="favicon.ico" /> <meta name="format-detection" content="telephone=no"> <meta name="format-detection" content="address=no"/> <link rel="dns-prefetch" href="page2.html"> <meta name="description" content=""/> <meta name="keywords" content=""/> Friday, November 15, 13
  • 25. Input Field Types <form> Date: <input type="date" value="2013-09-03" name="dateInput"> Datetime: <input type="datetime" name="datetimeInput"> Datetime-local: <input type="datetime-local" value="2013-09-03T20:00" name="datetime-local"> Email: <input type="email" name="emailInput"> Month: <input type="month" value="2013-09" name="monthInput"> Number: <input type="number" name="numberInput"> Password: <input type="password" name="passwordInput"> Range: <input type="range" name="rangeInput"> Search: <input type="search" name="searchInput"> Tel: <input type="tel" name="telInput"> Time: <input type="time" name="timeInput"> Url: <input type="url" name="urlInput"> </form> Friday, November 15, 13
  • 26. Required and Validation <input type="url" name="urlInput" required pattern="https?://.+"> ... input:required:invalid, input:focus:invalid { background-image: url(/images/invalid.png); background-position: right top; background-repeat: no-repeat; } input:required:valid { background-image: url(/images/valid.png); background-position: right top; background-repeat: no-repeat; } Friday, November 15, 13
  • 28. Interaction html { -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-user-select: none; } body{ -webkit-font-smoothing: antialiased; /* Fix for webkit rendering */ -webkit-text-size-adjust: 100%; } /* don't let "actions" dialog to come up when element is touch/held */ .prevent-action { -webkit-touch-callout: none; } Friday, November 15, 13
  • 29. Interaction continued /* no dragging of element at all */ .content p.no-drag { -webkit-user-drag: none; } /* drags entire element, not the text/selection */ .sidebar div.element-drag { -webkit-user-drag: element; } /* change the character used to hide user passwords */ input[type="password"] { -webkit-text-security: square; } textarea[contenteditable] { -webkit-appearance: none; } Friday, November 15, 13
  • 30. Hardware acceleration /* position */ -webkit-transform: translate(0, 0); -webkit-transform: translateZ(0); -webkit-transform: translate3d(0, 0, 0); /* scale */ -webkit-transform: scale(0); /* rotation */ -webkit-transform: rotate(0); /* opacity */ opacity: 0.5; Friday, November 15, 13
  • 31. Animations @-webkit-keyframes pulse { from { -webkit-transform: scale(.1); } to { -webkit-transform: scale(1); } } div { -webkit-animation-name: pulse; -webkit-animation-duration: 2s; -webkit-animation-iteration-count: infinite; -webkit-animation-timing-function: ease-in-out; -webkit-animation-direction: alternate; } // Javascript content.addEventListener("webkitAnimationIteration", countAnims, false); Friday, November 15, 13
  • 32. Transitions // CSS .box { left: 40px; -webkit-transition: all 0.3s ease-out; } div.box.totheleft { -webkit-transform: translate3d(0, 0, 0); } div.box.totheright { -webkit-transform: translate3d(80px, 0, 0); } // Javascript window.addEventListener("webkitTransitionEnd", function() { // Handle the end of the transition }, false); Friday, November 15, 13
  • 33. Media Queries @media screen and (orientation:portrait) { /* portrait-specific styles */ } @media screen and (orientation:landscape) { /* landscape-specific styles */ } @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (minresolution: 144dpi) { /* Style adjustments for viewports that meet the condition */ } Friday, November 15, 13
  • 35. Orientation Detection var mql = window.matchMedia("(orientation: portrait)"); if(mql.matches) { // Portrait orientation } else { // Landscape orientation } mql.addListener(function(m) { if(m.matches) { // Changed to portrait } else { // Changed to landscape } }); // Resizing window.addEventListener("resize", function() { // window.innerHeight > window.innerWidth ... }, false); Friday, November 15, 13
  • 36. Device Resolution var meta = document.createElement("meta"); meta.setAttribute('name','viewport'); var content = 'initial-scale='; content += 1 / window.devicePixelRatio; content += ',user-scalable=no'; meta.setAttribute('content', content); document.getElementsByTagName('head')[0].appendChild(meta); Friday, November 15, 13
  • 37. Canvas pre-rendering // no pre-rendering function render() { drawSpaceShip(context); requestAnimationFrame(render); } // pre-rendering var sprite = document.createElement('canvas'); sprite.width = 64; sprite.height = 64; var spriteCtx = sprite.getContext('2d'); drawSpaceShip(spriteCtx); function render() { context.drawImage(sprite, 0, 0); requestAnimationFrame(render); } Friday, November 15, 13
  • 38. Canvas batch calls // Slower for (var i = 0; i < points.length - 1; i++) { var p1 = points[i]; var p2 = points[i+1]; context.beginPath(); context.moveTo(p1.x, p1.y); context.lineTo(p2.x, p2.y); context.stroke(); } // Faster context.beginPath(); for (var i = 0; i < points.length - 1; i++) { var p1 = points[i]; var p2 = points[i+1]; context.moveTo(p1.x, p1.y); context.lineTo(p2.x, p2.y); } context.stroke(); Friday, November 15, 13
  • 39. Canvas Redraw Regions // redraw entire canvas context.fillRect(0, 0, canvas.width, canvas.height); // redraw only 'dirty' areas context.fillRect(last.x, last.y, last.width, last.height); // faster way to redraw canvas context.clearRect(0, 0, canvas.width, canvas.height) Friday, November 15, 13
  • 40. RequestAnimationFrame function animate(time){ //random drawing context.clearRect(0, 0, canvas.width, canvas.height); context.beginPath(); context.rect(x, y, 50, 50); context.fillStyle = '#8ED6FF'; context.fill(); // Old way: // window.setTimeout(animate, 1000/60); // New way: window.requestAnimationFrame(animate); } Friday, November 15, 13
  • 41. Reflows and repaints var bstyle = document.body.style; // cache bstyle.padding = "20px"; // reflow, repaint bstyle.border = "10px solid red"; // another reflow and a repaint bstyle.color = "blue"; // repaint only, no dimensions changed bstyle.backgroundColor = "#fad"; // repaint bstyle.fontSize = "2em"; // reflow, repaint // new DOM element - reflow, repaint document.body.appendChild(document.createTextNode('hello...')); Friday, November 15, 13
  • 42. Minimize dimension or location queries // Slower var elem = document.getElementById('animated'); elem.style.fontSize = (elem.offsetWidth / 10) + 'px'; elem.firstChild.style.marginleft = (elem.offsetWidth / 20) + 'px'; // Faster var elem = document.getElementById('animated'), elemWidth = elem.offsetWidth; elem.style.fontSize = (elemWidth / 10) + 'px'; elem.firstChild.style.marginleft = (elemWidth / 20) + 'px'; Friday, November 15, 13
  • 43. Debounce Events function SomeObject() { var self = this; this.lastExecThrottle = 500; // limit to one call every "n" msec this.lastExec = new Date(); this.timer = null; this.resizeHandler = function() { var d = new Date(); if (d-self.lastExec < self.lastExecThrottle) { if (self.timer) { window.clearTimeout(self.timer); } self.timer = window.setTimeout(self.resizeHandler, self.lastExecThrottle); return false; // exit } self.lastExec = d; // update "last exec" time self.callResizeHandlerFunctions(); } } var someObject = new SomeObject(); window.onresize = someObject.resizeHandler; Friday, November 15, 13
  • 45. Server MIME Types AddType text/cache-manifest .manifest AddType text/cache-manifest .appcache AddType application/x-web-app-manifest+json .webapp Friday, November 15, 13
  • 46. App cache manifest CACHE MANIFEST # Version 1.0 # filename: app.manifest or name.appcache CACHE: index.html Game-Break.mp3 Game-Death.mp3 Game-Shot.mp3 Game-Spawn.mp3 main.js main.css three.min.js ... <html manifest="app.manifest"> Friday, November 15, 13
  • 47. W3C Web App Manifest { "name": "Flip.io", "description": "Flip.io - 999 Word Puzzles. A simple, yet challenging word puzzle that will entertain novices and lexicographers alike. Presented with 10 word definitions and scrambled tiles of letter combos, can you find all the words?", "launch_path": "/", "icons": { "60": "/flip60.png", "128": "/flip128.png" }, "developer": { "name": "Russell Beattie", "url": "http://flip.io" }, "default_locale": "en", "fullscreen": "true" } Friday, November 15, 13
  • 48. Amazon Mobile Web App Platform Manifest { "verification_key": "insert your verification key from the App File(s) tab", "launch_path": "index.html", "permissions": [ "iap", "geolocation", "auth" ], "type": "web", "version": "0.1a", "last_update": "2013-04-08 13:30:00-0800", "created_by": "webappdev" } Friday, November 15, 13
  • 49. Real World App Demo Friday, November 15, 13
  • 50. Please give us your feedback on this presentation MBL301 As a thank you, we will select prize winners daily for completed surveys! Thank You @RussB • beattier@amazon.com developer.amazon.com/webapps Friday, November 15, 13