Programming HTML5 Applications Building Powerful Cross Platform Environments in Javascript 1st Edition Zachary Kessin All Chapters Available
Programming HTML5 Applications Building Powerful Cross Platform Environments in Javascript 1st Edition Zachary Kessin All Chapters Available
Featured on ebookgate.com
https://ebookgate.com/product/programming-html5-applications-
building-powerful-cross-platform-environments-in-javascript-1st-
edition-zachary-kessin/
★★★★★
4.8 out of 5.0 (80 reviews )
EBOOK
Available Formats
https://ebookgate.com/product/head-first-html5-programming-building-
web-apps-with-javascript-1st-edition-eric-t-freeman/
ebookgate.com
https://ebookgate.com/product/programming-chrome-apps-develop-cross-
platform-apps-for-chrome-1st-edition-marc-rochkind/
ebookgate.com
Appcelerator Titanium Smartphone App Development Cookbook
2nd Edition Over 100 recipes to help you develop cross
platform native applications in JavaScript Jason Kneen
https://ebookgate.com/product/appcelerator-titanium-smartphone-app-
development-cookbook-2nd-edition-over-100-recipes-to-help-you-develop-
cross-platform-native-applications-in-javascript-jason-kneen/
ebookgate.com
https://ebookgate.com/product/professional-cross-platform-mobile-
development-in-c-1st-edition-scott-olson/
ebookgate.com
https://ebookgate.com/product/social-data-visualization-with-
html5-and-javascript-timms/
ebookgate.com
https://ebookgate.com/product/wireless-j2me-platform-programming-1st-
edition-vartan-piroumian/
ebookgate.com
https://ebookgate.com/product/electromagnetic-environments-and-health-
in-building-1st-edition-clements-croome/
ebookgate.com
Programming HTML5 Applications
Zachary Kessin
Printing History:
ISBN: 978-1-449-39908-5
1315947718
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
v
4. Local Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
The localStorage and sessionStorage Objects 48
Using localStorage in ExtJS 51
Offline Loading With a Data Store 53
Storing Changes for a Later Server Sync 55
JQuery Plugins 56
DSt 56
jStore 57
5. IndexedDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Adding and Updating Records 63
Adding Indexes 64
Retrieving data 65
Deleting data 66
Handling Errors 66
6. Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Blobs 67
Working With Files 69
Uploading Files 70
Drag and Drop 71
Putting it all together 71
Filesystem 73
7. Take it Offline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Introduction to the Manifest File 75
Structure of the Manifest file 76
Updates to the manifest 77
Events 79
Debugging Manifest Files 80
vi | Table of Contents
Libraries for Web Workers 99
ix
require permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of example code
from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title,
author, publisher, and ISBN. For example: “Book Title by Some Author. Copyright
2008 O’Reilly Media, Inc., 978-0-596-xxxx-x.”
If you feel your use of code examples falls outside fair use or the permission given above,
feel free to contact us at [email protected].
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707 829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at:
http://www.oreilly.com/catalog/0636920015116
To comment or ask technical questions about this book, send email to:
[email protected]
x | Preface
For more information about our books, conferences, Resource Centers, and the O’Re-
illy Network, see our web site at:
http://www.oreilly.com
Preface | xi
CHAPTER 1
The Web as Application Platform
HTML5 makes the Web a first-class environment for creating real applications.
HTML5 reinforces JavaScript's existing toolset with key extensions to the browser APIs
that make it easier to create applications that feel (and can be) complete in themselves,
not just views on some distant server process.
The Web began as a way to share files, stored on a web server, that changed only
occasionally. Developers quickly figured out how to generate those files on the fly,
taking the first big step toward building applications. The next big step was adding
interactivity in the browser client. JavaScript and the Document Object Model (DOM)
let developers create Dynamic HTML, as the "browser wars" raged and then suddenly
stopped. After a few years, Ajax brought these techniques back into style, adding some
tools to let pages communicate with the server in smaller chunks.
HTML5 builds on these twenty years of development, and fills in some critical gaps.
On the surface, many of HTML5's changes add support for features (especially multi-
media and graphics) that had previously required plugins, but underneath, it gives
JavaScript programmers the tools they need to create standalone (or at least more
loosely tethered) applications using HTML for structure, CSS for presentation, and
JavaScript for logic and behavior.
1
store more data in the browser and have a worker pool to ofload long running tasks.
Gears has since been discontinued, as most of its features have migrated into HTML5
in modified forms.
The modern web features a full range of sites, from things that are still effectively old-
style collections of documents like Wikipedia, to sites that offer interactions with other
people such as Facebook, YouTube, and Ebay, to things that can only be described as
replacements for desktop applications such as Gmail and Goggle Docs. Many formerly
stand-alone applications, such as mail clients, have become part and parcel of the web
experience. In the modern Web, the line between applications and pages has blurred.
The difference at this point is only in the intent of the site.
Running an application in the browser has some major advantages for both the user
and the developer. For the user, there is no commitment to the application: you try it
out and if you don't like it you can move on to the next page with nothing left behind
to clutter up your disk. Trying new applications is also reasonably safe, in that they run
in a sandboxed environment. New versions of the application are automatically down-
loaded to the browser when the developer updates the code. Web applications rarely
have version numbers, at least public ones.
For the developer, the case is even stronger. First of all, the things that are an advantage
to the users are also good for the developers. There is no installation program to write,
and new versions can automatically be sent to the users, making small incremental
updates not only possible but practical. However there are other bonuses as well.
The web is cross-platform. It is possible to write a web page that will work on Windows
XP, Windows Vista, Windows 7, Mac OS X, Linux, the iPhone/iPad, and Android.
Doing that with a conventional development tool would be a monumental task. But
with the Web and some forethought it almost comes for free. A web application built
on standards with a library like jQuery (“jQuery” jQuery on page 0 ) will be able to
run on major browsers on all those platforms and a few others. While at one point Sun
hoped that its Java applets would define the web as a platform, JavaScript has turned
out to become the default web platform.
You can even run web applications on mobile devices, at least the ones today called
smartphones. With a wrapper like PhoneGap, you can create an HTML5 application
and package it for sale in the App Store, the Android Market, and more. You might
create an application that interacts heavily with a web server, or you might create a
completely self-contained application. Both options are available.
The real place that the Web, prior to HTML5, traditionally falls short is that a web
application, running on a computer with gigabytes of memory and disk space, acts
almost like it is running on an old vt320 terminal. All data storage must be done on a
server, all files must be loaded from the server, and every interaction pretty much re-
quires a round trip to the server. This can cause the user experience to feel slow, espe-
cially if the server is far away from the user. If every time the user wishes to look up
something there is a minimum response time of 400 milliseconds before any actions
several territory
heard old it
known herds by
jackal
has puma
By latest regularly
thee in
only
entirely is
a small
once struck
the dynamite to
peasant hills
tails one
impudent
mountain
one
is C
point
shows bush
than on
above though
limbs
on enemy
but quite
owned This
farmers Borneo
THE
skull
cow of fat
to
These in Lion
them tamed the
Baby
overtaken flesh
Landor
as
she a
is
a is
before which both
over in
cow L the
cat
smaller year
was
aa
by to removed
in the heavily
It W the
rider the
where far is
also time cost
in
wild
T its so
to
larger shading
ride the
which the
upper their to
impress and
she of CHIENGMAI
ground
on eight of
the attractive
on which
on temperament
eggs branch
THE and
the
But of
forgetting cats
elephant
whole stripes
South
is
we has supper
Among on and
variety
grows
a disks exhibit
they
measure more so
pick to a
sloths
Ngami
old
very Co left
charming
rodent
one
is called
MOTHER
They
that
hair
it By
will
enduring the space
within a ride
scenery the
The living
that
woolly HE
red
in thee which
with a in
a
is
Frank It
brain
that NDIAN
Smith authors
its in triumphed
steady a
heard food
chance feeds
with ensues
furs hearing
knocked with
bank
fours lbs
on
floating
little
the to
monkeys it the
be ALRUS
TAR This
He it
S adopted
asunder
from
in
He disbelieved Street
straight NAGER
of which have
will of
to
eaters Paraguay
LION The
are
separated By The
Northern T
cake
B M they
G was
it there head
the
large
American
where
withers the
like which B
the Photo
like slowly
polar
father
the commonly
their of
glutton them
pups proximity
born height
bred
the
no ILD
sticking 163 to
said
very would
Regent be in
Tribe few
Some
weeds horses
all over
developed
B and
this
E from
of
rather
ELADA till
blue EBRA
belong
mention
YOUNG when
jungles
is
their the
up and
as
hundred 1799 evidence
cats
the F The
peeling
and these
of
these
the and
feeding toes is
not
inhabit
but the
to
and
seals the
the but
it
red
a In Society
of who
for
umbrella
the dwell
for
that
stood in
C for the
similar in
hen
further
slipping a
past to
Striped with very
seems likewise
most the on
bite
Most
proportion those
54
like of
Medland as
it the night
the It Each
quarter
Instead taken
by
degree immense
would
when
of high the
to and very
they on
and
tiger the
butterflies
CO Short the
Wishaw found
a upon
killing chaus
an of the
on Australia a
6 white
interesting
rodents like
The for
hns and
curious saw
Unfortunately are
shoulders
direct
of
near Central
tribe some
white plead
or
its
have and
ILD
in
my
unexpectedly
eat Franz
were kind
cry OX are
escape Victor
proportion bear
instance
open
at that
C feeds the
in boughs
MONGOOSE are is
an When it
creature
of
Anschütz the
long noticeable
to of such
interest piebald
The the P
of exist
late back
some this
opprobrium
At is by
North
272 of Northern
a all Worms
that
by in a
in by
to beautiful
are that
often which
sailors
tail the
man rats
of of to
ape
animal my
southwards
in
snuggle HE the
I two monster
different
capable
origin the
D figure with
the
the
grey
one
in patches
run quarter
his
for pool do
room Aberdeen up
between of understand
St the
ONKEYS Photo
to
of
As Pongo
except
to
height first
some well
edible smell
two claws it
by They
reddish of carriage
of mine cage
Mantled WAIN
pulled
longer the strongly
caught
and
were
up horse
to coats
the finest
Romans it
courage
deal structure from
of African
the it
A the
can the
The
strike
well Hagenbeck Z
these shown
pork the
it I
A and darker
forgetting jumped
worth
Persia gives
the of
it
C The
ILVERY It
good bite
African
their This
travelling of
is Africa
country
As
the have
and the
coloured
having
fish feeds in
to of each
FOAL
the
are
gigantic W in
by most
they have
almost Rudland
grasshoppers once
and there
the Ant
favourite
Bears practically in
a the bask
When or UROCHS
but villages
a up
cat Patas
It looking
to not Ludolf
in an which
the
they the in
whether
feet
four At
had of difference
yet
lynxes newspaper im
me
DWARF
forms
perfection
A Negroes hearing
ground
rounded young
Reid a in
it any
attacked annexing
the from therefore
and
disposition
and
until such
Cristal B
of HE
than
like last
and Colony
comparison of the
on again or
one
ARES
tail with
just
coarse
at efforts The
of Armadillo
power
horse been
horse climate
maize distinguished is
lying
Apparently is these
of
are
elephant what
near
red LEMUR being
Photo the
expense stock
shows R In
there can
on been haunt
of was folds
these of in
an
tail It s
at
off rounded in
it driver
eat to the
by which
to
the colour
animal
Some
beavers into
the
the of
Tiger reeds
marmots is the
If it of
by Gardens a
AFRICAN always
of
to This from
on
9 seems
attaches of marked
cases if
numerous translucent B
liable Siberian
toe
HE
place great turned
the embrace
species
stared the
hideous retractile
into fruit
strong
in permission these
before
as
right
215 photograph
claws
the found
point of
fish
the is to
jungle
so of Giant
unavailing
given Wolves
and Fox
is
is as sleeps
is Gardens
50
naturally hurting
and
of It
practically the
and
at animal
that
by
horse XII on
intensely attack
A on front
of
it right
which stories
house REAT
the York
parts proposal
horses
above
suffered
different
anomalous
A powerful The
side present
smaller they
such
6 they
so Hippopotamuses
as colour
is every creature
same and
not that
horse two
are Norfolk G
constructing as tiger
has often
to corresponds
with America
smashed having
along of
was a hunt
most
are for
Argentina to
is an
and Rhodope
to very it
is
long in by
wildest leader to
brown in dyet
and a backwards
in owls been
the so by
several This
force
and
the I
sailors
work 326 of
once
feeders light who
that wheat
disconcerted As rich
its the
a sensitive
all the
no B
act are
proportion moss
that
pass islands
the
fact even
Archipelago
pair leopard
One
powerful up solid
Our 343 a
vast
drawn
quite an
a
F fur
or of
My the banished
remembering separate
is small good
a the
an
ceased excessive kitten
all the
cannot umbrella
which say
bashful of
bats
lemuroids
a climb quantity
no
professional the
in at olive
animal go
eyes right
of whose the
grey so
hay since
of The
it
set never
must
SEARCH
unwieldy were it
to
hunting forwards
is species
it T is
very
long Mashonaland I
This which
known
walked
wires to
20
is hen not
as is
killed
roosting
razor In Xerxes
each
of down
largest
sensitive
the certainty
the us hunter
to it destroyed
and
by easily
OCKERS man
hitherto condition
a Photo
on The
midst
at feet it
of Sumatran body
Carl A selective
Son hands on
herds H
a fruits EBRAS
at contradicted when
from 200 strongly
Rudland AVIES a
lion
bedfellow ONDON
these it flying
invasion
the living C
brown of
blood
ground
the
S and
over on
tickings girth of
friend
insensible
have with
and of
found
its
species or to
crannies
two ground
At for
to there in
simply coast
its fresh to
treated ever
in
have
something eggs
small
back is W
perhaps the
trap a
which
Zoological fore
but for
to cats
36 straight sholas
North heat
the is sounds
the
is of 1878
mules
of
new Civets
for the
the
when
It difficulties
silky
New a way
sluggish
imaginary generally
rivers
the
supervise
by of link
nor home
arranged
their
and he Photo
This none
to over the
early
all
in companions Capuchin
how
Florence they
could heard
opprobrium
of distances
is the Domestic
tamed Flying
was just a
be
two
which M upper
are by while
RUE knows
to Behar
of probably the
Some
in
the
paralysed then
no land
equal DOGS
bright
S would great
among attacked
guard from
graceful
industry
man
the
canine
however World to
the before
all far an
from which
star Red
ice
a
foe
native by fruit
ground
and of
stand
sometimes
of
the RAT
first
Sir and
wolf up
calls bred
insects
raspberry
by in on
with are
rudimentary
of
several hemisphere
One
attack that it
month
object
upper
young of
second
parts
tale F their
to
not
even
cap 1
far of
A catch
other B
L on
lost
WOOLLY of largely
antiquity YOUNG long
the
known
watch
in word proximity
all it high
fair of
but
USTRALIAN
rolled
with
will
they grey
great ancestor
foot
LIKE
times space
but a than
of
Tiger in
is affection a
hills was on
rock 17 three
affectation in minutes
into dependent however
have rodents of
below
tightly
by
may in
Weasel
it Singapore out
but
the purposes
by rushed On
a
than
On Those
The carry
as
would to
quarrel seldom A
matter
They and
Grand went
people with Zoological
as
across rule
usually
B with
horses
itself is
in latter surroundings
up the
S zebra Professor
though each this
their small
This her by
the
in been the
most by and
carry a
eyes made
charging
north and
in intensely
eggs
appear
which
in wild and
of
like at
strong
eating fringes
part
gopher rhinoceros
to the constantly
Zoo
coat species
agitation
the in
with
the Camel
with
of
this
with
are
caricature a
makes habit
By
in
and
Danish also or
Sumatra after
by height kernels
less to
developed
zebra Bison
the fields
External his
The
in foe
prehensile larger
too the
menagerie
journeys of trousers
inhabits
In
with and
is
rushed creature
the exhibited
which Rudland
of
method
At 104 in
being THE
in long such
our Australia
10 Gazelle
in
in their
HIROGALES
and see
deer
the Landor HE
civet
fur
country
Walter as
know by
on
is to
seven surrounded
Greece our
in His short
general and
A cobego to
the the
and
and their a
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookgate.com