当前位置:网站首页>Three methods of local storage
Three methods of local storage
2022-06-24 04:56:00 【Hu Zai Zai!】
Local storage is divided into cookie、localStorage、sessionStorage
cookie
cookie Designed to communicate with the server , Instead of local storage , He was just borrowed to local storage
cookie There are some disadvantages : Small storage space , Maximum 4k、http The request needs to be sent to the server , Increase the amount of requested data 、 Only use document.cookie='…' To modify the , Too simple
localStorage、sessionStorage
stay HTML5 in , Added a new localStorage/sessionString characteristic , This feature is mainly used as local storage , It's solved cookie Lack of storage space (cookie Each of them cookie The storage space of is 4k),localStorage The general browser support in 5M size .
advantage :HTML5 Designed specifically for storage , Maximum storage capacity 5M、API Simple and easy to use setItem getItem、 Not as http The request was sent
localStorage、sessionStorage Difference
localStorage The data will be stored permanently , Unless code or manually deleted
sessionStorage The data will only exist in the current session , browser
Clear if closed
It's usually used localStorage There will be more
Be careful :localStorage Only support string Type of storage
边栏推荐
- ribbon
- SAP mts/ato/mto/eto topic 7: ATO mode 1 m+m mode strategy 82 (6892)
- 一文简述:供应链攻击知多少
- mini-Web框架:装饰器方式的添加路由 | 黑马程序员
- Black horse programmer machine learning handout: preliminary use of linear regression API
- Chemical properties and specificity of Worthington Papain
- Redis pipeline technology speed and efficiency increased by 5 times
- Bi-sql insert into
- NLP baked gluten
- Functional advantages of industrial wireless router
猜你喜欢

Introduction to C language custom types (structure, enumeration, union, bit segment)

什么是数据中台

『渗透基础』Cobalt Strike基础使用入门_Cobalt Strike联动msfconsole

What is the data center

Abnova fluorescence in situ hybridization (FISH) probe solution

Loss and optimization of linear regression, machine learning to predict house prices

Abnova peptide design and synthesis solutions

一款支持内网脱机分享文档的接口测试软件

Apipost interface assertion details

Idea创建Servlet 后访问报404问题
随机推荐
How RedHat 8 checks whether the port is connected
Introduction to gradient descent method - black horse programmer machine learning handout
An interface testing software that supports offline document sharing in the Intranet
Let children learn the application essence of steam Education
What technology is VPS? How does the server VPS?
Abnova peptide design and synthesis solutions
一款支持内网脱机分享文档的接口测试软件
LeetCode 1662. Check whether two string arrays are equal
mini-Web框架:装饰器方式的添加路由 | 黑马程序员
How to build an ECS and how to control the server through the local host
How to build a website for ECS is the price of ECS very expensive
Many regulations come into effect today! The main responsibility of network security will be further implemented
Are you ready for the exam preparation strategy of level II cost engineer in 2022?
Deep learning NLP from RNN LSTM Gru seq2seq to attention classification and analysis
What is the data center
Integration of Alibaba cloud SMS services and reasons for illegal message signing
让孩子们学习Steam 教育的应用精髓
event
How to install software on ECs is it expensive to rent ECS
C语言自定义类型的介绍(结构体,枚举,联合体,位段)