Horje
How to create HTML Web Storage Objects | HTML Web Storage API Code
How to create 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)

Example of HTML Web Storage Objects

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

index.html
Example: HTML
<script>
if (typeof(Storage) !== "undefined") {
  // Code for localStorage/sessionStorage.
} else {
  // Sorry! No Web Storage support..
}
</script>

Output should be:

Example of HTML Web Storage Objects
Reffered: https://www.w3schools.com/html/html5_webstorage.asp



Read Full::
HTML Web Storage API Code
Category:
HTML Code
Sub Category:
HTML Web Storage API Code
Uploaded:
1 month ago
Uploaded by:
Admin
Views:
1

Related Articles
What is HTML Web Storage API HTML Web Storage API Code
What is HTML Web Storage? HTML Web Storage API Code
What Browsers will Support HTML Web Storage API HTML Web Storage API Code
How to create HTML Web Storage Objects HTML Web Storage API Code
How to create HTML localStorage Object HTML Web Storage API Code
How to create HTML sessionStorage Object HTML Web Storage API Code

Single Articles
Example of HTML Web Storage Objects

Share on: