Skip to content

Commit 4a20875

Browse files
authoredFeb 11, 2024
Update article.md
1 parent ee62307 commit 4a20875

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎6-data-storage/01-cookie/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ alert( document.cookie ); // cookie1=value1; cookie2=value2;...
3131
```
3232

3333

34-
The value of `document.cookie` consists of `name=value` pairs, delimited by `; `. Each one is a separate cookie.
34+
The value of `document.cookie` consists of `name=value` pairs, delimited by `;`. Each one is a separate cookie.
3535

36-
To find a particular cookie, we can split `document.cookie` by `; `, and then find the right name. We can use either a regular expression or array functions to do that.
36+
To find a particular cookie, we can split `document.cookie` by `;`, and then find the right name. We can use either a regular expression or array functions to do that.
3737

3838
We leave it as an exercise for the reader. Also, at the end of the chapter you'll find helper functions to manipulate cookies.
3939

@@ -255,7 +255,7 @@ Overall, `samesite` is a great option.
255255

256256
There's a drawback:
257257

258-
- `samesite` is ignored (not supported) by very old browsers, year 2017 or so.
258+
- `samesite` is ignored (not supported) by very old browsers, the year 2017 or so.
259259

260260
**So if we solely rely on `samesite` to provide protection, then old browsers will be vulnerable.**
261261

@@ -269,7 +269,7 @@ The web-server uses the `Set-Cookie` header to set a cookie. Also, it may set th
269269

270270
This option forbids any JavaScript access to the cookie. We can't see such a cookie or manipulate it using `document.cookie`.
271271

272-
That's used as a precaution measure, to protect from certain attacks when a hacker injects his own JavaScript code into a page and waits for a user to visit that page. That shouldn't be possible at all, hackers should not be able to inject their code into our site, but there may be bugs that let them do it.
272+
This is used as a precautionary measure, to protect from certain attacks when a hacker injects his own JavaScript code into a page and waits for a user to visit that page. That shouldn't be possible at all, hackers should not be able to inject their code into our site, but there may be bugs that let them do it.
273273

274274

275275
Normally, if such a thing happens, and a user visits a web-page with hacker's JavaScript code, then that code executes and gains access to `document.cookie` with user cookies containing authentication information. That's bad.

0 commit comments

Comments
 (0)
Failed to load comments.