What is Html Web storage

0 votes
Explain the html web storage in details?. Does it related to any cache related stuffs??
Jan 31 in HTML by kartik
• 10,740 points
67 views

1 answer to this question.

0 votes

With web storage, web applications can store data locally within the user's browser.

Before HTML5, application data had to be stored in cookies, included in every server request. Web storage is more secure, and large amounts of data can be stored locally, without affecting website performance.

Unlike cookies, the storage limit is far larger and information is never transferred to the server.

Web storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data. We can store data in an object

HTML Web Storage Objects

HTML web storage provides two objects for storing data on the client:

  • window.localStorage - stores data with no expiration date
  • window.sessionStorage - stores data for one session (data is lost when the browser tab is closed)

Before using web storage, check browser support for localStorage and sessionStorage:

if (typeof(Storage) !== "undefined") {
  // Code for localStorage/sessionStorage.
} else {
  // Sorry! Edureka web site error..........
}
You,can also store data in localstorage as well.

The localStorage Object

The localStorage object stores the data with no expiration date. The data will not be deleted when the browser is closed, and will be available the next day, week, or year.

Example

// Store
localStorage.setItem("lastname", "Edureka");

// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");
answered Jan 31 by Niroj
• 21,640 points

Related Questions In HTML

0 votes
1 answer

How to Identify Web Element( Button) when there are multiple buttons without any ID

Hi Gangadhar, Do you need the HTML code to ...READ MORE

answered Feb 10 in HTML by Roshni
• 600 points
75 views
0 votes
0 answers

Anyone can help me out to understand the semantic of (document.getElementBYId("demo").innerHTML="Hello") ?

Hello guys, Can Someone helps me to find ...READ MORE

Jan 17 in Web Development by anonymous
• 10,740 points
47 views
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20 in Web Development by Niroj
• 21,640 points

edited Jan 21 by Niroj 67 views
+1 vote
1 answer

What are pseudo class in css??

Hey, The state of an element is controlled  by ...READ MORE

answered Jan 20 in Web Development by Niroj
• 21,640 points

edited Jan 21 by Niroj 49 views
0 votes
1 answer

How can i create simple register form using html and css?

Html5 contains lots of elements using which ...READ MORE

answered Jan 31 in HTML by Niroj
• 21,640 points
369 views
0 votes
1 answer

HTML - Change\Update page contents without refreshing\reloading the page?

Hii kartik, onclick handlers run on the client side, ...READ MORE

answered Apr 23 in HTML by Niroj
• 21,640 points
25 views
0 votes
1 answer

What is the best practice for updating an already existing web app deployment using ARM?

The Service Principal solution, through the SDK, ...READ MORE

answered Jul 8, 2018 in Other DevOps Questions by Atul
• 10,240 points
57 views
0 votes
1 answer

What is the best "Web API Authentication" practice?

Talking about the best practice, consider the ...READ MORE

answered Aug 6, 2018 in Azure by null_void
• 3,220 points
111 views