mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 10:00:39 -04:00
feat(curriculum): add interactive examples to client side storage negative patterns lesson (#63832)
Co-authored-by: shy-away <shy-away@tuta.io>
This commit is contained in:
@@ -5,7 +5,7 @@ challengeType: 19
|
||||
dashedName: what-are-some-negative-patterns-associated-with-client-side-storage
|
||||
---
|
||||
|
||||
# --description--
|
||||
# --interactive--
|
||||
|
||||
Client-side storage allows websites to store data on a user's device. However, like many technologies, it can be misused.
|
||||
|
||||
@@ -31,11 +31,15 @@ This technique uses client-side information to create a unique "fingerprint" of
|
||||
|
||||
Here's a simple example of how a website can create a fingerprint of you:
|
||||
|
||||
:::interactive_editor
|
||||
|
||||
```js
|
||||
let fingerprintExample = navigator.userAgent + screen.width + screen.height;
|
||||
console.log(fingerprintExample);
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
This code combines your browser's user agent with your screen dimensions. While this is a basic example, real fingerprinting methods are much more complex and can be highly accurate in identifying users.
|
||||
|
||||
`localStorage` can also be misused as some websites use it to store sensitive information insecurely. For instance:
|
||||
|
||||
Reference in New Issue
Block a user