Book Image

Mastering Dart

By : Sergey Akopkokhyants
Book Image

Mastering Dart

By: Sergey Akopkokhyants

Overview of this book

Table of Contents (19 chapters)
Mastering Dart
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Web Storage


Web Storage (or DOM storage) represents a mechanism for a better and more secured way of persisting data on the client than cookies. Web Storage is better in the following situations:

  • When you need greater storage capacity (it can keep 5 - 10 MB per the available storage, depending on the web browser)

  • When you don't need to communicate with the server to manage the client data

  • When you don't want the stored data to expire

  • When the stored data spans across different tabs or windows of the same browser

There are two Web Storage objects (Session and Local) that can be used to persist the user data in the web browser for the length of the session and indefinitely. Both of them have a similar simple API declared via the Storage interface. Web Storage has an event-driven implementation. The storage event is fired whenever a storage area changes.

The Session storage

The Session storage is available through the window.sessionStorage attribute. It is intended to keep short-lived data opened...