Cookie
=== Request Headers ===
......
Cookie: AGL_USER_ID=f695f47d-f643-46cec-bf63-6255asdasdqwe4b3a24
... ......
1 document.cookie = 'cookname=cookievalue' // default setting
document.cookie = 'cookname=cookievalue;expires=Mon Jul 04 2022 16:36:24 GMT'
document.cookie = 'cookname=cookievalue;expires=Mon Jul 04 2022 16:36:24 GMT; domain=www.xxx.com'
document.cookie
document.cookie = 'cookname=cookievalue; expires=Thu, 01 Jan 1970 00:00:00 GMT'
Simple version package
// Simple packaging
const CookieUtile = {
// Set up
setCookie(key, value, time) {
const date_ = new Date()
date_.setDate(date_.getDate() + time) // current time + Expiration time
document.cookie = key + '=' + value + ';expires=' + date_ // Write to document
},
// Set up
getCookie(key) {
const CookieArray = document.cookie.split(';') // Multiple cookie adopt ; Split into multiple by ' key = value ' Array of components
for (let i = 0; i < array.length; i++) {
const newCookieArray = CookieArray[i].split('=') // Remove the equal sign in the middle Get a new array with only key values
const newCookieKey = newCookieArray[0].replace(/^\s/, '') // Remove multiple cookie When saving value, it may appear cookie There is a space in front of the value name of
if (newCookieKey == key) {
return newCookieArray[1]
}
return ''
}
},
// Delete
getCookie(key) {
this.setCookie('name', '', -1);
} }
Talk about client storage technology Cookie More related articles in this article
- Common browser side storage technology :cookie
working principle : cookie It is stored in the user's hard disk , Every time a user visits a site ,Web Applications can read Cookie Information contained . When the user visits the site again , The browser will search the local hard disk for the URL The associated Cookie. ...
- HTML5 Client storage of (Storage)
About client storage technology storage One . About clients ( browser ) Storage technology The first thing you can think of about browser storage technology is cookie, About cookie Its original intention is to solve the problem of client identification , Small amount of information can be stored (4k about ) ...
- Conversational Technology ( Cookie ,Session)
Conversational Technology : conversation : The browser accesses the server , Send multiple requests , Accept multiple responses . Until one of them is disconnected . End of session . solve the problem : You can use conversation Technology , Sharing data between multiple requests in a session . ...
- 【 translate 】 Client storage (Client-Side Storage)
Reprinted from : Many translators become translators : Wenlin link :http://www.zcfy.cc/article/660 original text :http://www.html5rocks.com/en/tutorials/offline/st ...
- Servlet Chapter five 【 Introduce conversation Technology 、Cookie Of API、 Detailed explanation 、 application 】
What is conversational technology Basic concepts : It means that the user opens a browser , Visit a website , As long as you don't close the browser , No matter how many hyperlinks the user clicks , How many resources to visit , Until the user closes the browser , The whole process is called a conversation . Why do we use conversation Technology ...
- Node.js_express_ Browser storage technology Cookie( The server stores and manages a small amount of data in the browser )
Browser storage technology Cookie The server stores and manages a small amount of data in the browser solve http The problem of stateless protocol ( Cannot distinguish whether multiple requests are sent from the same client ) A web page is usually the most 20 One of the cookie, Every cookie ...
- H5 Local storage technology and its relationship with Cookie Comparison
The first part : H5 Local storage technology HTML5 Provides two new ways to store data on the client side . Let's look at the following example : example 1:var mySelection = {name:"car", amount: ...
- Web Client data storage learning notes ——Cookie
Today's security of login access and web Client storage did some general learning , Decided to deepen understanding in this area , Recorded in the blog . The first contact is Cookie... WHAT? WHY? HOW? I'm learning cookie The name of ...
- Client technology :Cookie Server technology :HttpSession
Client technology :Cookie Server technology :HttpSession 07. 5、 ... and / android Basics / No comments One . Conversational Technology 1. What is conversation : The customer opens a browser to visit a website , After the visit , Close the browser . this ...
- Servle Fourth articles ( Conversational technology cookie)
Conversational Technology What is conversational technology Basic concepts : It means that the user opens a browser , Visit a website , As long as you don't close the browser , No matter how many hyperlinks the user clicks , How many resources to visit , Until the user closes the browser , The whole process is called a conversation . Why should we make ...
Random recommendation
- ajaxsearch The main points of 1
ajaxsearch You have to put form Of class Defined as pagerForm, Can be in foot in submit Button to get the value
- php Understanding of some common functions
mysql_result($res, $row, [$field=0]) Is to get the query result set One of them The content of the unit . among , $row Is the line offset , $field Is column offset , Or index , from 0 At the beginning . ...
- MySQL Take advantage of Ameoba Read and write separation
3 ameoba Installation configuration 3.1 Installation configuration JDK [[email protected] ~]# rpm -ivh jdk-7u67-linux-x64.rpm [[email protected] ~]# cd /usr/j ...
- Customize your own linux Small system
Customize your own linux Small system One . Preface linux Operating system to 1991.10.5 Since the birth of the U.S , Because of its open source and freedom, it has won the favor of many technology giants , Every linux Fans have contributed their part to it , No matter what ...
- typedef and define Specific differences
1) #define This is a preprocessing instruction , Simply replace the preprocessor . Do not check the correctness , It still cannot shut down and enter normally , There are only possible errors and errors when compiling the source code when it has been expanded . for example : #define PI 3.1 ...
- swift UILabel When multiple lines are displayed Calculation UILable Height ( Can be used for UILable Highly adaptive )
The code is as follows func heightForView(text:String, font:UIFont, width:CGFloat) -> CGFloat{ let label:UILabel = ...
- ORA-16032: parameter LOG_ARCHIVE_DEST_3 destination string cannot be translated Problem handling process
1, Phenomenon is oracle Start to report an error, such as the following : SQL> startup ORA-16032: parameter LOG_ARCHIVE_DEST_3 destination string cann ...
- C++ Primer note —— Nested class Local class
1. A nested class is a separate class , It has little to do with outer classes . In particular , Objects of outer classes and objects of nested classes are independent of each other . The object of a nested class does not contain any members defined by the outer class , There are also no nested class defined members in the objects of the outer class . 2. nesting ...
- windows Password policy
windows Configure password policy in domain environment : http://www.cnblogs.com/danzhang/p/3693024.html windows Configure password policy : https://jingyan.baid ...
- cracking the coding interview series C# Realization
The original content is transferred from :CTCI Interview series —— Google interviewer classic | Fast class network This series is C# Implementation version Google interviewer classic (CTCI) Catalog 1.1 Determine whether the characters in a string are unique 1.2 String flip 1.3 Remove ...