当前位置:网站首页>The differences and usage of cookies, localstorage and sessionstorage
The differences and usage of cookies, localstorage and sessionstorage
2022-07-19 01:59:00 【666 sign】
cookie It is used to save the request information of the client browser request server page
HTML5 Of WebStorage Two types are available API:localStorage( The local store ) and sessionStorage( Session storage )
WebStorage The aim is to overcome the problem of cookie Some of the restrictions , When data needs to be strictly controlled on the client side , No need to send data back to the server continuously
The common point of the three is to save in the browser , And homologous
Here are the differences between them
Life cycle
cookie: Can pass expires Set the expiration time , If you do not set the default to close the browser, it will be invalid
localStorage: Unless removed by hand , Otherwise permanent
sessionStorage: Effective only during the current session , Close the page and it will be invalid
Storage size
cookie:4KB about
localStorage、sessionStorage: It can be saved 5M Information about
HTTP request
cookie: Every time I carry it in http In the head , Overuse cookie Performance issues
localStorage、sessionStorage: Only on the client side ( Browser ) Kept in , Does not participate in communication with the server
Ease of use
cookie: It needs to be packaged by the programmer himself , Original Cookie The interface is not friendly
localStorage、sessionStorage: The source interface can accept , It can also be packaged again Object and Array There is better support
Application scenarios
cookie: Suitable for identifying user login
localStorage and sessionStorage The only difference is that it is permanently saved in the browser , One is to close the web page and clear the information
localStorage: It can be used to pass parameters across pages
sessionStorage: To save temporary data , Prevent users from losing parameters after refreshing the page
边栏推荐
- 边缘检测方法 -- 一阶边缘检测
- 06基于STM32的智能电子药盒设计
- remote sensing 投稿流程
- PCA主成分分析(降维)过程推导
- 14:07:08 ckati failed with: signal: killed
- 静态库与动态库
- 常见的Go写文件方式
- MXNet网络模型(五)条件GAN神经网络
- iFair: Learning Individually Fair Data Representations for Algorithmic Decision Making
- Fairness in Semi-supervised Learning: Unlabeled Data Help to Reduce Discrimination
猜你喜欢

uniapp打包H5 空白页面 报错 Uncaught SyntaxError: Unexpected token ‘<‘

【文献阅读】Multi-state MRAM cells for hardware neuromorphic computing
![[literature reading] vaqf: full automatic software hardware co design framework for low bit vision transformer](/img/41/aca6596b1fa50a1940791e6e00a17a.png)
[literature reading] vaqf: full automatic software hardware co design framework for low bit vision transformer

Fisher线性判别分析Fisher Linear Distrimination

04基于ZigBee的室内无线定位系统设计

Learning Transferable Visual Models From Natural Language Supervision

Détection de bord de deuxième ordre laplacien de guassian Gaussian laplacien Operator

性能强悍的图表组件库 ScottPlot

动手学深度学习--多层感知机篇(MLP)

高斯分布的性质(含代码)
随机推荐
【MySQL】windows安装MySQL 5.6
VIM 配置文件
Fairness in Deep Learning: A Computational Perspective
Fair Multiple Decision Making Through Soft Interventions
【Go语言】动态库和静态库详解
禁止自作聪明的Safari打开网页时自动播放
[MySQL] windows install MySQL 5.6
One vs One Mitigation of Intersectional Bias
【Go语言】代码覆盖测试(gcov)
Rivaliser pour la guerre clé des utilisateurs de stock, aider les entreprises à construire un système d'étiquetage parfait 丨 01 examen en direct
偏差(bias)和方差(variance)
动手学深度学习--多层感知机篇(MLP)
Neutralizing Self-Selection Bias in Sampling for Sortition
网络安全新架构:零信任安全
PCA主成分分析(降维)过程推导
openGauss Developer Day 2022|东方通诚邀您莅临“东方通生态工具分论坛”
windwos 下载安装OpenSSH
基于深度学习的加密流量识别研究综述及展望
常见的Go写文件方式
判断两个数组是否完全相等