Local Storage, Session storage, Web storage, web database and cookies in HTML5

前端 未结 5 2187
闹比i
闹比i 2020-12-14 01:22

What is the difference between these concepts, and when should I use one in particular? Does this listing also contain different names for the same general concept?

5条回答
  •  误落风尘
    2020-12-14 01:38

    HTML5 web storage is a generic umbrella term for the new client-side data storage options.

    Local Storage is persistent and scoped to the domain. At the moment two flavors are usually mentioned:

    • 'default': stores things in name/value pairs
    • Web SQL (aka Web Database): uses an SQL database

    Session Storage is non persistent and scoped only to the current window.

    Cookies are the old school way of doing all of the above. Stores name/value pairs per domain.

提交回复
热议问题