• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Html5 storage api
 

Html5 storage api

on

  • 1,737 views

 

Statistics

Views

Total Views
1,737
Views on SlideShare
1,363
Embed Views
374

Actions

Likes
1
Downloads
6
Comments
0

4 Embeds 374

http://servidor 365
http://localhost 5
http://www.linkedin.com 3
http://www.capuche.com.br 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Html5 storage api Html5 storage api Presentation Transcript

    • Jean Carlo Nascimento  a.k.a. SUISSA  
    • nosqlbr.com.br jquerybrasil.org frontendbrasil.com.br github.com/suissa about.me/suissa @osuissa
    •  
      • Sem API
      • name=value
      • Tamanho máximo 4Kb    
      • enviado ao server em toda requisição
    •  
      • function setCookie(c_name,value,exdays){
      •      var exdate=new Date();
      •      exdate.setDate(exdate.getDate() + exdays);
      •      var c_value=escape(value) + ((exdays==null) ? "" : ";     
      •      expires="+exdate.toUTCString());
      •      document.cookie=c_name + "=" + c_value;
      • fonte:  http://www.w3schools.com/js/js_cookies.asp
    •  
      • function getCookie(c_name){
      •      var i,x,y,ARRcookies=document.cookie.split(";");
      •      for (i=0;i<ARRcookies.length;i++){
      •            x=ARRcookies[i].substr(0,ARRcookies[i].indexOf(&quot;=&quot;));
      •            y=ARRcookies[i].substr(ARRcookies[i].indexOf(&quot;=&quot;)+1);
      •            x=x.replace(/^s+|s+$/g,&quot;&quot;);
      •            if (x==c_name){
      •                  return unescape(y);
      •              }
      •        }
      • }
      • fonte:  http://www.w3schools.com/js/js_cookies.asp  
    •  
      • API Storage
      • key/value
      • Tamanho máximo 5Mb
      • não enviado ao servidor
    •  
      • SQL
      • Relacional
      • Tamanho padrão 5MB 
      • (ilimitado via manifest)
      • não enviado ao servidor
    •  
      • Ind exed Database API Objetos(JSON)
      • Tamanho padrão 5MB 
      • (ilimitado via manifest)
      • não enviado ao servid or
    •  
      • function supports_sessionStorage() {
      •   try {
      •     return 'sessionStorage' in window && window['sessionStorage'] !== null;
      •   } catch (e) {
      •     return false;
      •   }
      • }
      • if (Modernizr.sessionstorage) {
      •   // sessionStorage esta disponível!
      • } else {
      •   // bad bad browser, no donuts for you.
      • }
      • function supports_localStorage() {
      •   try {
      •     return 'localStorage' in window && window['localStorage'] !== null;
      •   } catch (e) {
      •     return false;
      •   }
      • }
      • if (Modernizr.localstorage) {
      •   // sessionStorage esta disponível!
      • } else {
      •   // bad bad browser, no donuts for you.
      • }
      • function supports_webSQL() {
      •   try {
      •     return !!window.openDatabase;
      •   } catch (e) {
      •     return false;
      •   }
      • }
      • if (Modernizr.websqldatabase) {
      •   // WebSQL esta disponível!
      • } else {
      •   // bad bad browser, no donuts for you.
      • }
      • function supports_indexedDB() {
      •   try {
      •     return !!window.indexedDB || 
      •      !!window.webkitIndexedDB || 
      •      !!window.mozIndexedDB;
      •   } catch (e) {
      •     return false;
      •   }
      • }
      • if (Modernizr.indexeddb) {
      •   // IndexedDB esta disponível!
      • } else {
      •   // bad bad browser, no donuts for you.
      • }
    •  
    • localStorage.setItem() localStorage.getItem() localStorage.clear() localStorage.key() localStorage.removeItem() sessionStorage.setItem() sessionStorage.getItem() sessionStorage.clear() sessionStorage.key() sessionStorage.removeItem()
    •  
    • Asynchronous API
      • IDBCursor         
      • IDBDatabase
      • IDBFactory
      • IDBEnvironment
      • IDBIndex
      • IDBObjectStore
      • IDBRequest
      • IDBTransaction
      • IDBVersionChangeEvent
      • IDBVersionChangeRequest
    • Synchronous API*
      • IDBCursorSync
      • IDBDatabaseSync
      • IDBEnvironmentSync
      • IDBFactorySync
      • IDBIndexSync
      • IDBObjectStoreSync
      • IDBTransactionSync
      • *não implementada ainda.
    • Referências
      • http://dev.w3.org/html5/webstorage/#the-sessionstorage-attribute
      • http://dev.w3.org/html5/webstorage/#dom-localstorage
      • http://dev.w3.org/html5/webdatabase/
      • http://www.w3.org/TR/IndexedDB/  
      • https://developer.mozilla.org/en/IndexedDB