"New open standards created in
the mobile era, such as HTML5,
will win on mobile devices. "
Steve Jobs
April, 2010
http://www.apple.com/hotnews/thoughts-on-flash/
"HTML5 is now universally supported
on major mobile devices.
This makes HTML5 the best solution for
creating and deploying content in the
browser across mobile platforms."
Danny Winokur
November 9, 2011
http://blogs.adobe.com/conversations/2011/11/flash-focus.html
@media only screen
and (max-device-width: 1024px)
and (orientation: portrait),
(-webkit-min-device-pixel-ratio: 2)
and (max-device-width: 640px)
{ ... }
window.matchMedia
// get MediaQueryList
var mql = window.matchMedia(
'screen and (orientation: portrait)');
mql.addListener(function(mql){
if (mql.matches) {
console.log('portrait');
} else {
console.log('landscape');
}
});
matchMedia() polyfill
make sure it's hidden
document.createElement('div');
create a <style> node with a media attribute
set a CSS rule applied to a <div>
check to see if the style has been applied
return { matches: bool, media: ma }
http://www.nczonline.net/blog/2012/01/03/css-media-queries-in-javascript-part-1/
Web Workers
Inline Workers Use Cases
WebKitBlobBuilder Prefetching Data
MozBlobBuilder Processing large
arrays, humungous
JSON responses
Handling Errors Updating many rows
"message", "error" of a local web
database
http://www.html5rocks.com/en/tutorials/workers/basics/
paging...
render
paging in background threads
render
Prerender
<link rel="prerender"
href="http://read.douban.com/reader" />
Book Store Reader
Reader
http://prerender-test.appspot.com/
https://developers.google.com/chrome/whitepapers/prerender
Store Reader
if (document.visibilityState === 'hidden'
|| document.visibilityState === 'prerender'
|| document.hidden === 'ture') {
stopSyncReadingProgress();
}
http://www.w3.org/TR/2011/WD-page-visibility-20110602/
SVG
Configure Web Server MIME types
".svg" => "image/svg+xml"
Creating & Converting & Optimizing
Aviary Raven SVG-edit
Vector Magic Scour
SVG in CSS backgrounds
// fallback for IE 6/7/8
background: url(icons.png);
// for modern browsers
background: rgba(0,0,0,0) url(icons.svg);
IE 6/7/8 don't support rgba color values
will automatically ignore this rule
http://caniuse.com/#feat=svg-css
Touch Events
touchstart init
touches Array (1 or 11)
touchmove update
touchInfo
touchend use pageX, pageY
touchcancel clear time
thresholds
Gestures
CACHE MANIFEST
# version 1.0.1
Can't include fragment identifiers.
app.html#reader
/ark/js/* A full file name is required, no wildcards allowed.
/ark/logo.png favicon.ico
CACHE: Only one file per line.
http://img3.douban.com/pics/cover.png
# online whitelist
NETWORK:
#*
/j/reader/
FALLBACK:
fallback.html
* Enhance Application Cache for better performance:
/ark/icon-reader.svg , ETag: ...
app.html ETag: ... , Last-Modified: ...
Reduces network bandwidth & latency
with additional meta-data
updated manifest file
Server Client
re-fetch each resouce
newer ? re-fetch : 304
only re-fetch definitely updated files
Detecting Connection
if (navigator.onLine) {
// send data to server
} else {
// use Web Storage or Database
}
window.addEventListener( reading progress
'online', function(e) {
// sync data with server
}, false);
notes & comments
╮(╯_╰)╭
Weinre
need to use machine's Wrapper
public IP address
must be connected
to the Internet
some updates in
Chrome are not
shown on devices
http://forums.adobe.com/docs/DOC-1674