cookies会话保持原理_Cookies vs会话存储vs本地存储

news/2024/5/18 13:42:58 标签: python, cookie, leetcode, session, 数据库

cookies会话保持原理

As a front-end engineer, web application storage’s mechanism is not a stranger to us, but in daily operations, it’s not that frequently being called. In this article, we are going to cover Cookies, Local Storage, Session Storages, clarify their definitions and explore how to call them exactly.

作为一名前端工程师,Web应用程序存储的机制对我们来说并不陌生,但是在日常操作中,它并不是经常被调用的机制。 在本文中,我们将介绍Cookie,本地存储,会话存储,阐明它们的定义并探讨如何准确地调用它们。

定义 (Definitions)

One more thing to mention, Cookies support both HTML4 and HTML5, others only support HTML5. Practically, it’s not that important.

还有一件事要提到,Cookie同时支持HTML4HTML5 ,其他仅支持HTML5 。 实际上,它并不那么重要。

怎么打电话 (How to Call)

饼干 (Cookies)

Cookies are put inside of document global object. Although it will be parsed as key-value style object, there’s no friendly API to read/write as an object. Developer need to manually write the string.

Cookies放在文档全局对象内部。 尽管它将被解析为键值样式对象,但没有友好的API可以作为对象进行读取/写入。 开发人员需要手动编写字符串。

Image for post

会话存储和会话存储 (Session Storage & Session Storage)

Both support easy read/write interface, but like JSON, but both key and value have to be string.

两者都支持简单的读/写接口,但类似于JSON,但是键和值都必须是字符串。

Image for post
Local Storage
本地存储
Image for post
Session Storage
会话存储

如何调试 (How to Debug)

The easiest way is:

最简单的方法是:

  1. Open browser(like Chrome)

    打开浏览器(如Chrome)
  2. Open Developer Console

    打开开发者控制台
  3. Click “Application” tab. On the right hand column, you will see the structured view for all the storage info inside browser

    单击“应用程序”选项卡。 在右侧列上,您将看到浏览器中所有存储信息的结构化视图
Image for post
Debug in Chrome
在Chrome中调试

翻译自: https://medium.com/dev-genius/cookies-vs-session-storage-vs-local-storage-ae38a4be0e53

cookies会话保持原理


http://www.niftyadmin.cn/n/1496716.html

相关文章

Hyperledger学习资料

https://www.hyperledger.org/community 官方学习文档https://github.com/hyperledger/burrowInstall goEnsure you have gmp installed (sudo apt-get install libgmp3-dev || brew install gmp)and execute following commands in a terminal:go get github.com/Masterminds…

HBase基本概念和hbase shell常用命令用法

1. 简介 HBase是一个分布式的、面向列的开源数据库,源于google的一篇论文《bigtable:一个结构化数据的分布式存储系统》。HBase是Google Bigtable的开源实现,它利用Hadoop HDFS作为其文件存储系统,利用Hadoop MapReduce来处理HBase中的海量数…

原生js实现一个简单轮播效果

代码简单&#xff0c;直接上&#xff1a; <!DOCTYPE html> <html> <head><title>轮播</title><meta charset"utf-8"><style type"text/css">*{padding:0;margin:0;}.mainCss{width:100px;height: 200px;positio…

LINUX下的iptables

我给大家讲一下iptables iptables有三种链 1&#xff1a;INPUT (进来的链) 2&#xff1a;OUTPUT(出去的链) 3&#xff1a;FORWARD(转发的链) iptables -A INPUT -p icmp -j DROP -A(添加一个链) -p 协议 -j(添加动作) 说明添加一个进来的链。协议是icmp动作 拒绝。 iptables -L…

docker 保存 环境持久化_「docker干货集中营」- 持久化存储与数据共享

有些容器会自动产生一些数据&#xff0c;为了不让数据随着container的消失而消失&#xff0c;保证数据的安全性。例如&#xff1a;数据库容器&#xff0c;数据表的表会产生一些数据&#xff0c;如果我吧container给删除&#xff0c;数据就丢失。为了保证数据不丢失&#xff0c;…

简单的图形学(一)

看到叶大的文章用JavaScript玩转计算机图形学(一)光线追踪入门 - Milo Yip - 博客园&#xff0c;里面有几个小例子&#xff0c;所以把这些效果用C再实现一遍。bajdcc/GameFramework&#xff0c;这一系列停更好久了&#xff0c;只是没想到比较有趣的点子&#xff0c;拿它来练习再…

js控制单选复选框(全选)

//获取单选按钮的选项值function f1() {//radio集合var radios document.getElementsByName("sex");for (var i 0; i < radios.length; i) {if (radios[i].checked) {alert(radios[i].value);break;}}}<input type"checkbox" id"chkAll"…

python矩阵相乘函数,矩阵矩阵乘法的函数numpy.dot(),@和方法.dot()之间有什么区别?...

Is there any difference? If not, what is preferred by convention?The performance seems to be almost the same.anp.random.rand(1000,1000)bnp.random.rand(1000,1000)%timeit a.dot(b) #14.3 ms 374 s per loop (mean std. dev. of 7 runs, 100 loops each)%timeit …