---
title: "What is the use of localStorage in HTML5 ?"  
description: "What is the use of localStorage in HTML5 ?"  
author: "Anonymous User"  
published: 2012-09-06  
updated: 2020-09-24  
canonical: https://www.mindstick.com/interview/1518/what-is-the-use-of-localstorage-in-html5  
category: "html5"  
tags: ["html5"]  
reading_time: 2 minutes  

---

# What is the use of localStorage in HTML5 ?

Before HTML5 LocalStores was done with cookies. Cookies are not very good for large amounts of data, because they are passed on by every request to the server, so it was very slow and in-effective.\
\
In HTML5, the data is NOT passed on by every server request, but used ONLY when asked for. It is possible to store large amounts of data without affecting the website's performance.and The data is stored in different areas for different websites, and a website can only access data stored by itself.\
\
And for creating localstores just need to call localStorage object like below we are storing name and address\

```
<script type="text/javascript">localStorage.name="PCDS";document.write(localStorage.name);</script><script type="text/javascript">localStorage.address="Mumbai India..";document.write(localStorage.address);</script>
```

## Answers

### Answer by Anonymous User

Before HTML5 LocalStores was done with cookies. Cookies are not very good for large amounts of data, because they are passed on by every request to the server, so it was very slow and in-effective.\
\
In HTML5, the data is NOT passed on by every server request, but used ONLY when asked for. It is possible to store large amounts of data without affecting the website's performance.and The data is stored in different areas for different websites, and a website can only access data stored by itself.\
\
And for creating localstores just need to call localStorage object like below we are storing name and address\

```
<script type="text/javascript">localStorage.name="PCDS";document.write(localStorage.name);</script><script type="text/javascript">localStorage.address="Mumbai India..";document.write(localStorage.address);</script>
```


---

Original Source: https://www.mindstick.com/interview/1518/what-is-the-use-of-localstorage-in-html5

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
