You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 6-data-storage/01-cookie/article.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,9 @@ We leave it as an exercise for the reader. Also, at the end of the chapter you'l
39
39
40
40
## Writing to document.cookie
41
41
42
-
We can write to `document.cookie`. But it's not a data property, it's an accessor. An assignment to it is treated specially.
42
+
We can write to `document.cookie`. But it's not a data property, it's an accessor (getter/setter). An assignment to it is treated specially.
43
43
44
-
**A write operation to `document.cookie`passes through the browser that updates cookies mentioned in it, but doesn't touch other cookies.**
44
+
**A write operation to `document.cookie` updates only cookies mentioned in it, but doesn't touch other cookies.**
45
45
46
46
For instance, this call sets a cookie with the name `user` and value `John`:
47
47
@@ -52,7 +52,7 @@ alert(document.cookie); // show all cookies
52
52
53
53
If you run it, then probably you'll see multiple cookies. That's because `document.cookie=` operation does not overwrite all cookies. It only sets the mentioned cookie `user`.
54
54
55
-
Technically, name and value can have any characters, but to keep the formatting valid they should be escaped using a built-in `encodeURIComponent` function:
55
+
Technically, name and value can have any characters, to keep the valid formatting they should be escaped using a built-in `encodeURIComponent` function:
0 commit comments