---
title: "What are the different types of storage in HTML 5?"  
description: "What are the different types of storage in HTML 5?"  
author: "Anonymous User"  
published: 2011-10-11  
updated: 2020-09-24  
canonical: https://www.mindstick.com/interview/1293/what-are-the-different-types-of-storage-in-html-5  
category: "html5"  
tags: ["html5"]  
reading_time: 1 minute  

---

# What are the different types of storage in HTML 5?

HTML5 offers two new objects for storing data on the client:

**LocalStorage** - stores data with no time limit

<script type="text/javascript">\
localStorage.lastname="Smith";\
document.write(localStorage.lastname);\
</script>

**SessionStorage** - stores data for one session.The data is deleted when the user closes the browser window.

<script type="text/javascript">\
sessionStorage.lastname="Smith";\
document.write(sessionStorage.lastname);\
</script>

## Answers

### Answer by Anonymous User

HTML5 offers two new objects for storing data on the client:

**LocalStorage** - stores data with no time limit

<script type="text/javascript">\
localStorage.lastname="Smith";\
document.write(localStorage.lastname);\
</script>

**SessionStorage** - stores data for one session.The data is deleted when the user closes the browser window.

<script type="text/javascript">\
sessionStorage.lastname="Smith";\
document.write(sessionStorage.lastname);\
</script>


---

Original Source: https://www.mindstick.com/interview/1293/what-are-the-different-types-of-storage-in-html-5

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
