SlideShare a Scribd company logo
Web Storage
Presenter: Vinod Mohan
Presenter: Vinod MohanPresenter: Vinod Mohan
What is Web Storage?
Web storage and DOM storage (document object
model) are web application software methods and protocols
used for storing data in a web browser. Web storage
supports persistent data storage, similar to cookies but with
a greatly enhanced capacity and no information stored in
the HTTP request header.
Presenter: Vinod Mohan
Why Store Data in Web Browser
The main reason is practicality. JavaScript code running
on the browser does not necessarily need to send all
information to the server. There are several use cases:
●
You want to increase performance. You can cache data
client-side so it can be retrieved without additional server
requests.
●
You have a significant quantity of client-side-only data,
e.g. HTML strings or widget configuration settings.
●
You want you make your application work off-line.
Presenter: Vinod MohanPresenter: Vinod Mohan
What we are using now?
Cookies:- Cookies were invented early in the web’s history,
and indeed they can be used for persistent local storage of
small amounts of data.
Cookies are domain-specific chunks of data. They sound
tasty, but handling is awkward.
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
How Cookies work?
●
Server sends some data to the visitor's browser
in the form of cookie.
●
The browser stores the same as plain text record
on the visitor's hard drive.
●
Now, When the visitor arrive at the another page
on the same site, the browser sends the same
cookie to server for retrival.
●
Once retrived, your server knows/remembers
what was stores earlier
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
The Limitations of Cookies
●
Cookies are included with every HTTP request, thereby
sending data unencrypted over the internet(unless SSL
verified) and transmitting the same data over and over
●
Cookies have data limitations, about to 4KB per cookie
●
Most browers allowed limited number of cookies per
domain.
●
Privacy and Security issues
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
What we really want is?
●
Lot of storage space.
●
Data should persists beyond a page refresh.
●
Data should not be transmitted to server
●
On the Browser
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Introducing HTML5 Web Storage
HTML5 Web Storage is a way for web pages to store
named key/value pairs locally, within the client web
browser. Like cookies, this data persists even after you
navigate away from the web site, close your browser tab,
exit your browser, or what have you.
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Browser support
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Before HTML5
●
At first, Started in IE. Microsoft invented a great
many things, DHTML Behaviors(userData). UserData
allows 64 KB per domain.
●
In 2002, Adobe introduced flash cookies in flash
environment, properly known as Local Shared Object
allows upto 100 KB of data per domain.
●
Brad Neuberg developed an early prototype of a Flash
to-JavaScript bridge called AMASS (AJAX Massive
Storage System), but it was limited by some of Flash’s
design quirks.
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Before HTML5 continued
●
By 2006, with the advent of ExternalInterface in Flash 8,
accessing LSOs from JavaScript became an order of
magnitude easier and faster.
●
Brad rewrote AMASS and integrated it into the popular
Dojo Toolkit under the moniker dojox.storage. Flash
gives each domain 100 KB of storage “for free”.
●
In 2007, Google launched Gears, provided an API to an
embedded SQL database based on SQLite.
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Web Storage types
Web Storage comes in two flavours and both uses
the Key-value pair combination,
1. Local Storage,
Exists untill it is removed or expired and available
across multiple tabs
2. Session Storage,
Once the window or tab is closed, the data stored
is erased.
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Web Storage Strengths
●
The ease of use for developers: It has a simple AOI to
get and set key/value pairs and can do much more.
●
The amount of space provided: no less than 5 or 10 MB
per domain.
●
The LocalStorage object stores data with no expiration.
●
Clent- Side Access: Servers cannot directly write into
web storage.
●
Data transmission: Objects are not sent automatically
with each request but must be requested.
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Web Storage Weaknesses
●
Data is stored as a simple string.
●
It has default 5 MB limit; more storage can be allowed
by user if required.
●
It can be disabled by the user or systems administrator.
●
Storage can be slow with complex sets of data
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Web Storage APIs
●
setItem(Key, Value) – Adds an item to storage
●
getItem(Key) - Retrives an item from storage
●
removeItem(Key) – Removes an item from storage
●
Clear() - Removes all items from storage
●
key(n) - Returns the name of the key for the index
provided
●
Length - Number of key/value pairs in the storage list
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
How to check browser supports or not?
// is localStorage available?
if (typeof window.localStorage != "undefined") {
alert(“Storage is working.”);
} else {
alert(“Storage is not working.”)
}
You can download JS at http://modernizr.com/
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Working of setItem(key, value)
// is localStorage available?
if (typeof window.localStorage != "undefined") {
// Local storage
localStorage.setItem("hello", "Hello World!");
//Session storage
sessionStorage.setItem("hello", "Hello World!");
} else {
alert(“Storage is not working.”)
}
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Working of getItem(key)
// is localStorage available?
if (typeof window.localStorage != "undefined") {
// Local storage
var local = localStorage.getItem("hello");
alert(hello + “from Local Storage”);
//Session storage
var session = sessionStorage.setItem("hello");
alert(hello + “from Session Storage”);
} else {
alert(“Storage is not working.”)
}
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Working of removeItem(key)
// is localStorage available?
if (typeof window.localStorage != "undefined") {
// Local storage
localStorage.removeItem("hello");
//Session storage
sessionStorage.removeItem("hello");
} else {
alert(“Storage is not working.”)
}
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Working of clear, key & Length
//to clear all
localStorage.clear();
//to read all
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var data = localStorage[key];
console.log(data);
}
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Storage Event
●
When ever we store data in local storage, event is fired
in other windows/tabs
●
This event can be used to synchronice the data in
defferent tabs
Syntax:
window.addEventListener('storage', function(event) {
console.log('The value for '+event.key+' changes from
'+event.oldValue+' to '+event.newValue);
}) ;
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Storage Event
●
When ever we store data in local storage, event is fired
in other windows/tabs
●
This event can be used to synchronice the data in
defferent tabs
Syntax:
window.addEventListener('storage', function(event) {
console.log('The value for '+event.key+' changes from
'+event.oldValue+' to '+event.newValue);
}) ;
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
References
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
●
http://www.sitepoint.com/html5-web-storage
●
http://www.html5rocks.com/en/features/storage
●
http://diveintohtml5.info/storage.html
Examples:
●
http://www.ellipsetours.com/Demos/storage/
●
http://html5demos.com/storage
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
Thank You
Email: vinodm@mindfiresolutions.com,
Skype: mfsi_vinodm,
Mob No: +91 – 9620453625.
Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan

More Related Content

What's hot (20)

PPTX
Document object model(dom)
rahul kundu
 
PPTX
Bootstrap ppt
Nidhi mishra
 
PPT
cascading style sheet ppt
abhilashagupta
 
PPT
Html5
Tony Nguyen
 
PPTX
Node js introduction
Joseph de Castelnau
 
PPT
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
PPT
Web Application Introduction
shaojung
 
PPTX
Introduction to HTTP protocol
Aviran Mordo
 
PPTX
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
PDF
Beautiful soup
mustafa sarac
 
PPTX
Web application architecture
Tejaswini Deshpande
 
PPT
Span and Div tags in HTML
Biswadip Goswami
 
PDF
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
PPTX
NodeJS - Server Side JS
Ganesh Kondal
 
PPTX
Css types internal, external and inline (1)
Webtech Learning
 
PDF
Bootstrap
Jadson Santos
 
PDF
Django Introduction & Tutorial
之宇 趙
 
PPTX
Introduction to Node js
Akshay Mathur
 
PPTX
PHP FUNCTIONS
Zeeshan Ahmed
 
Document object model(dom)
rahul kundu
 
Bootstrap ppt
Nidhi mishra
 
cascading style sheet ppt
abhilashagupta
 
Node js introduction
Joseph de Castelnau
 
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Web Application Introduction
shaojung
 
Introduction to HTTP protocol
Aviran Mordo
 
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
Beautiful soup
mustafa sarac
 
Web application architecture
Tejaswini Deshpande
 
Span and Div tags in HTML
Biswadip Goswami
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
NodeJS - Server Side JS
Ganesh Kondal
 
Css types internal, external and inline (1)
Webtech Learning
 
Bootstrap
Jadson Santos
 
Django Introduction & Tutorial
之宇 趙
 
Introduction to Node js
Akshay Mathur
 
PHP FUNCTIONS
Zeeshan Ahmed
 

Viewers also liked (20)

PDF
PyCon 2012: Python for data lovers: explore it, analyze it, map it
Jacqueline Kazil
 
PDF
Html5 web storage
Mindfire Solutions
 
PDF
Html5 OffLine Database
Mindfire Solutions
 
PDF
Web Storage & Web Workers
Inbal Geffen
 
PPTX
Super Advanced Python –act1
Ke Wei Louis
 
PDF
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
PDF
Django e il Rap Elia Contini
WEBdeBS
 
PDF
PythonBrasil[8] closing
Tatiana Al-Chueyr
 
PDF
2 × 3 = 6
Tzu-ping Chung
 
PDF
Bottle - Python Web Microframework
Markus Zapke-Gründemann
 
PDF
라이트닝 토크 2015 파이콘
Jiho Lee
 
PDF
Website optimization
Mindfire Solutions
 
PPT
Digesting jQuery
Mindfire Solutions
 
PPTX
2016 py con2016_lightingtalk_php to python
Jiho Lee
 
ODP
Rabbitmq & Postgresql
Lucio Grenzi
 
PDF
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
PDF
The Django Book, Chapter 16: django.contrib
Tzu-ping Chung
 
KEY
Overview of Testing Talks at Pycon
Jacqueline Kazil
 
PPT
Load testing
Mindfire Solutions
 
PPT
Django-Queryset
Mindfire Solutions
 
PyCon 2012: Python for data lovers: explore it, analyze it, map it
Jacqueline Kazil
 
Html5 web storage
Mindfire Solutions
 
Html5 OffLine Database
Mindfire Solutions
 
Web Storage & Web Workers
Inbal Geffen
 
Super Advanced Python –act1
Ke Wei Louis
 
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
Django e il Rap Elia Contini
WEBdeBS
 
PythonBrasil[8] closing
Tatiana Al-Chueyr
 
2 × 3 = 6
Tzu-ping Chung
 
Bottle - Python Web Microframework
Markus Zapke-Gründemann
 
라이트닝 토크 2015 파이콘
Jiho Lee
 
Website optimization
Mindfire Solutions
 
Digesting jQuery
Mindfire Solutions
 
2016 py con2016_lightingtalk_php to python
Jiho Lee
 
Rabbitmq & Postgresql
Lucio Grenzi
 
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
 
The Django Book, Chapter 16: django.contrib
Tzu-ping Chung
 
Overview of Testing Talks at Pycon
Jacqueline Kazil
 
Load testing
Mindfire Solutions
 
Django-Queryset
Mindfire Solutions
 
Ad

Similar to Html5-Web-Storage (20)

PDF
Varnish at the BBC
grahamlyons
 
PDF
Make Browser Extensions Great Again
Dhaya B.
 
PDF
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Serdar Basegmez
 
PDF
Apache Flex and the imperfect Web
masuland
 
PDF
Mobile Meow at Mobilism
Greg Schechter
 
PDF
Debugging Web Apps on Real Mobile Devices
Dale Lane
 
PDF
Web DU Mobile Meow
Greg Schechter
 
PPTX
MongoDB.local Austin 2018: PetroCloud: MongoDB for the Industrial IOT Ecosystem
MongoDB
 
PDF
JS Days Mobile Meow
Greg Schechter
 
PPTX
HTML 5
Rajan Pal
 
PDF
IDEALIZE 2023 - NodeJS & Firebase Session
Brion Mario
 
PPT
(In)Security Implication in the JS Universe
Stefano Di Paola
 
PDF
Strategies for Context Data Persistence
FIWARE
 
PDF
Static site gen talk
Ben Adam
 
PPTX
Learn More About Object Store | MuleSoft Mysore Meetup #9
MysoreMuleSoftMeetup
 
PDF
20 tips for website performance
Andrew Siemer
 
KEY
Mongo Seattle - The Business of MongoDB
Justin Smestad
 
PPTX
Webinar: Customer Scale
ForgeRock
 
PDF
Mobile for PHP developers
Ivo Jansch
 
PDF
JS Days HTML5 Flash and the Battle for Faster Cat Videos
Greg Schechter
 
Varnish at the BBC
grahamlyons
 
Make Browser Extensions Great Again
Dhaya B.
 
Engage 2022: The Superpower of Integrating External APIs for Notes and Domino...
Serdar Basegmez
 
Apache Flex and the imperfect Web
masuland
 
Mobile Meow at Mobilism
Greg Schechter
 
Debugging Web Apps on Real Mobile Devices
Dale Lane
 
Web DU Mobile Meow
Greg Schechter
 
MongoDB.local Austin 2018: PetroCloud: MongoDB for the Industrial IOT Ecosystem
MongoDB
 
JS Days Mobile Meow
Greg Schechter
 
HTML 5
Rajan Pal
 
IDEALIZE 2023 - NodeJS & Firebase Session
Brion Mario
 
(In)Security Implication in the JS Universe
Stefano Di Paola
 
Strategies for Context Data Persistence
FIWARE
 
Static site gen talk
Ben Adam
 
Learn More About Object Store | MuleSoft Mysore Meetup #9
MysoreMuleSoftMeetup
 
20 tips for website performance
Andrew Siemer
 
Mongo Seattle - The Business of MongoDB
Justin Smestad
 
Webinar: Customer Scale
ForgeRock
 
Mobile for PHP developers
Ivo Jansch
 
JS Days HTML5 Flash and the Battle for Faster Cat Videos
Greg Schechter
 
Ad

More from Mindfire Solutions (20)

PDF
Physician Search and Review
Mindfire Solutions
 
PDF
diet management app
Mindfire Solutions
 
PDF
Business Technology Solution
Mindfire Solutions
 
PDF
Remote Health Monitoring
Mindfire Solutions
 
PDF
Influencer Marketing Solution
Mindfire Solutions
 
PPT
High Availability of Azure Applications
Mindfire Solutions
 
PPTX
IOT Hands On
Mindfire Solutions
 
PPTX
Glimpse of Loops Vs Set
Mindfire Solutions
 
ODP
Oracle Sql Developer-Getting Started
Mindfire Solutions
 
PPT
Adaptive Layout In iOS 8
Mindfire Solutions
 
PPT
Introduction to Auto-layout : iOS/Mac
Mindfire Solutions
 
PPT
LINQPad - utility Tool
Mindfire Solutions
 
PPT
Get started with watch kit development
Mindfire Solutions
 
PPTX
Swift vs Objective-C
Mindfire Solutions
 
ODP
Material Design in Android
Mindfire Solutions
 
ODP
Introduction to OData
Mindfire Solutions
 
PPT
Ext js Part 2- MVC
Mindfire Solutions
 
PPT
ExtJs Basic Part-1
Mindfire Solutions
 
PPT
Spring Security Introduction
Mindfire Solutions
 
Physician Search and Review
Mindfire Solutions
 
diet management app
Mindfire Solutions
 
Business Technology Solution
Mindfire Solutions
 
Remote Health Monitoring
Mindfire Solutions
 
Influencer Marketing Solution
Mindfire Solutions
 
High Availability of Azure Applications
Mindfire Solutions
 
IOT Hands On
Mindfire Solutions
 
Glimpse of Loops Vs Set
Mindfire Solutions
 
Oracle Sql Developer-Getting Started
Mindfire Solutions
 
Adaptive Layout In iOS 8
Mindfire Solutions
 
Introduction to Auto-layout : iOS/Mac
Mindfire Solutions
 
LINQPad - utility Tool
Mindfire Solutions
 
Get started with watch kit development
Mindfire Solutions
 
Swift vs Objective-C
Mindfire Solutions
 
Material Design in Android
Mindfire Solutions
 
Introduction to OData
Mindfire Solutions
 
Ext js Part 2- MVC
Mindfire Solutions
 
ExtJs Basic Part-1
Mindfire Solutions
 
Spring Security Introduction
Mindfire Solutions
 

Recently uploaded (20)

PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 

Html5-Web-Storage

  • 2. Presenter: Vinod MohanPresenter: Vinod Mohan What is Web Storage? Web storage and DOM storage (document object model) are web application software methods and protocols used for storing data in a web browser. Web storage supports persistent data storage, similar to cookies but with a greatly enhanced capacity and no information stored in the HTTP request header.
  • 3. Presenter: Vinod Mohan Why Store Data in Web Browser The main reason is practicality. JavaScript code running on the browser does not necessarily need to send all information to the server. There are several use cases: ● You want to increase performance. You can cache data client-side so it can be retrieved without additional server requests. ● You have a significant quantity of client-side-only data, e.g. HTML strings or widget configuration settings. ● You want you make your application work off-line.
  • 4. Presenter: Vinod MohanPresenter: Vinod Mohan What we are using now? Cookies:- Cookies were invented early in the web’s history, and indeed they can be used for persistent local storage of small amounts of data. Cookies are domain-specific chunks of data. They sound tasty, but handling is awkward.
  • 5. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan How Cookies work? ● Server sends some data to the visitor's browser in the form of cookie. ● The browser stores the same as plain text record on the visitor's hard drive. ● Now, When the visitor arrive at the another page on the same site, the browser sends the same cookie to server for retrival. ● Once retrived, your server knows/remembers what was stores earlier
  • 6. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan The Limitations of Cookies ● Cookies are included with every HTTP request, thereby sending data unencrypted over the internet(unless SSL verified) and transmitting the same data over and over ● Cookies have data limitations, about to 4KB per cookie ● Most browers allowed limited number of cookies per domain. ● Privacy and Security issues
  • 7. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan What we really want is? ● Lot of storage space. ● Data should persists beyond a page refresh. ● Data should not be transmitted to server ● On the Browser
  • 8. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Introducing HTML5 Web Storage HTML5 Web Storage is a way for web pages to store named key/value pairs locally, within the client web browser. Like cookies, this data persists even after you navigate away from the web site, close your browser tab, exit your browser, or what have you.
  • 9. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Browser support
  • 10. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Before HTML5 ● At first, Started in IE. Microsoft invented a great many things, DHTML Behaviors(userData). UserData allows 64 KB per domain. ● In 2002, Adobe introduced flash cookies in flash environment, properly known as Local Shared Object allows upto 100 KB of data per domain. ● Brad Neuberg developed an early prototype of a Flash to-JavaScript bridge called AMASS (AJAX Massive Storage System), but it was limited by some of Flash’s design quirks.
  • 11. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Before HTML5 continued ● By 2006, with the advent of ExternalInterface in Flash 8, accessing LSOs from JavaScript became an order of magnitude easier and faster. ● Brad rewrote AMASS and integrated it into the popular Dojo Toolkit under the moniker dojox.storage. Flash gives each domain 100 KB of storage “for free”. ● In 2007, Google launched Gears, provided an API to an embedded SQL database based on SQLite.
  • 12. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Web Storage types Web Storage comes in two flavours and both uses the Key-value pair combination, 1. Local Storage, Exists untill it is removed or expired and available across multiple tabs 2. Session Storage, Once the window or tab is closed, the data stored is erased.
  • 13. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Web Storage Strengths ● The ease of use for developers: It has a simple AOI to get and set key/value pairs and can do much more. ● The amount of space provided: no less than 5 or 10 MB per domain. ● The LocalStorage object stores data with no expiration. ● Clent- Side Access: Servers cannot directly write into web storage. ● Data transmission: Objects are not sent automatically with each request but must be requested.
  • 14. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Web Storage Weaknesses ● Data is stored as a simple string. ● It has default 5 MB limit; more storage can be allowed by user if required. ● It can be disabled by the user or systems administrator. ● Storage can be slow with complex sets of data
  • 15. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Web Storage APIs ● setItem(Key, Value) – Adds an item to storage ● getItem(Key) - Retrives an item from storage ● removeItem(Key) – Removes an item from storage ● Clear() - Removes all items from storage ● key(n) - Returns the name of the key for the index provided ● Length - Number of key/value pairs in the storage list
  • 16. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan How to check browser supports or not? // is localStorage available? if (typeof window.localStorage != "undefined") { alert(“Storage is working.”); } else { alert(“Storage is not working.”) } You can download JS at http://modernizr.com/
  • 17. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Working of setItem(key, value) // is localStorage available? if (typeof window.localStorage != "undefined") { // Local storage localStorage.setItem("hello", "Hello World!"); //Session storage sessionStorage.setItem("hello", "Hello World!"); } else { alert(“Storage is not working.”) }
  • 18. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Working of getItem(key) // is localStorage available? if (typeof window.localStorage != "undefined") { // Local storage var local = localStorage.getItem("hello"); alert(hello + “from Local Storage”); //Session storage var session = sessionStorage.setItem("hello"); alert(hello + “from Session Storage”); } else { alert(“Storage is not working.”) }
  • 19. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Working of removeItem(key) // is localStorage available? if (typeof window.localStorage != "undefined") { // Local storage localStorage.removeItem("hello"); //Session storage sessionStorage.removeItem("hello"); } else { alert(“Storage is not working.”) }
  • 20. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Working of clear, key & Length //to clear all localStorage.clear(); //to read all for (var i = 0; i < localStorage.length; i++) { var key = localStorage.key(i); var data = localStorage[key]; console.log(data); }
  • 21. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Storage Event ● When ever we store data in local storage, event is fired in other windows/tabs ● This event can be used to synchronice the data in defferent tabs Syntax: window.addEventListener('storage', function(event) { console.log('The value for '+event.key+' changes from '+event.oldValue+' to '+event.newValue); }) ; Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Storage Event ● When ever we store data in local storage, event is fired in other windows/tabs ● This event can be used to synchronice the data in defferent tabs Syntax: window.addEventListener('storage', function(event) { console.log('The value for '+event.key+' changes from '+event.oldValue+' to '+event.newValue); }) ;
  • 22. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan References Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan ● http://www.sitepoint.com/html5-web-storage ● http://www.html5rocks.com/en/features/storage ● http://diveintohtml5.info/storage.html Examples: ● http://www.ellipsetours.com/Demos/storage/ ● http://html5demos.com/storage
  • 23. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan
  • 24. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan Thank You Email: [email protected], Skype: mfsi_vinodm, Mob No: +91 – 9620453625. Presenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod MohanPresenter: Vinod Mohan