Más contenido relacionado
La actualidad más candente (20)
Similar a Your browser, my storage (20)
Más de Francesco Fullone (20)
Your browser, my storage
- 1. Your browser, my storage
a new approach on data storing
Francesco Fullone
ff AT ideato.it
- 2. Who am I
Francesco Fullone aka Fullo
- PHP developer since 1999
- President
- and Open Source Evangelist
- CEO @
- Nerd and geek
- 3. What we want is a lot of storage space, on
the client, that persists beyond a page
refresh and isn’t transmitted to the server.
~ M. Pilgrim
- 6. Cookies are introduced in
HTTP/1.0, limited to only 20 per
domain and 4KB each.
http://www.flickr.com/photos/betsyweber/4962298614/
- 7. Cookies are sent to
and from client at
any connection.
http://www.flickr.com/photos/dionhinchcliffe/4326080515
- 10. Adobe, in 2002, created the Flash
Cookies aka “Local Shared
Objects” for Flash 6.
Data storage increased to 100KB
but it was difficult to be used.
- 11. With Flash 8, in 2006,
Adobe introduced the
ExternalInterface
to allow Js to access
to the stored resources.
- 12. Between 2005 and 2007
dojox.storage is written by Brad
Neuberg as a Js->Flash bridge to
manage bigger chunks of data
(with user prompt over 1MB).
- 13. Google created Gears in 2007,
that introduced a database
paradigm (based on SQLite) to
the storage problem.
- 14. All these storage systems had
different APIs, a common
platform is needed by all the
browser vendors.
- 18. It is enabled by a file .manifest
that declares which resources
have to be saved locally.
(limited to 5MB).
- 20. Data storage is about
capturing specific
data, or resources the
user has expressed
interest in.
http://www.flickr.com/photos/bfionline/2380398365/
- 22. Web Storage is the simpler
implementation of the Data
Storage paradigm.
http://dev.w3.org/html5/webstorage/
- 23. Web Storage is based on a
structure of key-value pairs like
any JavaScript object.
localStorage.setItem("bar", foo);
- 24. Web Storage can save up to 5MB
but only as strings. So we have
to force a casting if needed.
var bar = parseInt(localStorage["bar"]);
- 25. Web Storage should be local
based or session based.
var bar = localStorage["bar"];
var foo = sessionStorage["foo"];
- 27. localStorage relies only on
client, so we have to track
changes and use storage.events
to sync server and client if
needed.
- 28. Web SQL Database is just an
offline SQL implementation,
based on SQLite.
http://dev.w3.org/html5/webdatabase/
- 30. Web SQL Database is not (yet)
supported by Microsoft and
Mozilla, instead it is on browsers
based on webkit.
- 31. IndexedDB is a nice compromise
between Web Storage and Web
SQL Database.
http://www.w3.org/TR/IndexedDB/
- 32. IndexedDB allows to create an
index on a certain field stored in
a standard key->value mapping.
- 33. IndexedDB is promoted by all
browsers vendor, but is not yet
officially supported by anyone!
Firefox 4 beta has a partial implementation.
- 34. FileAPI or File Storage will give
us a way to store a lot of data.
http://www.w3.org/TR/FileAPI/
- 35. File API includes FileReader and
FileWriter APIs.
Actually (FileReader) is partially supported only by
Chrome.
- 38. Detect if the storing feature is
supported by the browser (with
modernizr), otherwise degradate
to something else.
(ie. dojox.storage)
- 39. Protect against lost data,
sync automatically.
http://www.flickr.com/photos/neate_photos/3529558272/
- 41. Do not exceed in storing data,
you can store binary data base64
encoded but remember the
pitfalls in performance.
- 45. via Quinto Bucci 205
47023 Cesena (FC)
info AT ideato.it
www.ideato.it
rate this talk: http://joind.in/2126