Cookies vs local storage vs session storage

Developer
Size
2,167 Kb
Views
52,624

How do I make an cookies vs local storage vs session storage?

What is a cookies vs local storage vs session storage? How do you make a cookies vs local storage vs session storage? This script and codes were developed by Beau Carnes on 13 September 2022, Tuesday.

Cookies vs local storage vs session storage Previews

Cookies vs local storage vs session storage - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>cookies vs local storage vs session storage</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <h1 class="text-center">Cookies vs. Local Storage vs. Session Storage</h1>
<table class="table table-striped"> <thead class="thead-inverse"> <tr> <th></th> <th>Cookies</th> <th>Local Storage</th> <th>Session Storage</th> </tr> </thead> <tbody> <tr> <th scope="row">Capacity</th> <td>4kb</td> <td>10mb</td> <td>5mb</td> </tr> <tr> <th scope="row">Browsers</th> <td>HTML4 / HTML 5</td> <td>HTML 5</td> <td>HTML 5</td> </tr> <tr> <th scope="row">Accessible from</th> <td>Any window</td> <td>Any window</td> <td>Same tab</td> </tr> <tr> <th scope="row">Expires</th> <td>Manually set</td> <td>Never</td> <td>On tab close</td> </tr> <tr> <th scope="row">Storage Location</th> <td>Browser and server</td> <td>Browser only</td> <td>Browser only</td> </tr> <tr> <th scope="row">Sent with requests</th> <td>Yes</td> <td>No</td> <td>No</td> </tr> </tbody>
</table> </div> <script src="js/index.js"></script>
</body>
</html>

Cookies vs local storage vs session storage - Script Codes CSS Codes

.table { margin-top: 10px; box-shadow: 0px 0px 3px 5px purple;
}
table { background: white;
}
body { background: plum ;
}

Cookies vs local storage vs session storage - Script Codes JS Codes

/* cookies vs local storage vs session storage */
localStorage.setItem('lunch', 'cereal');
console.log(localStorage.getItem('breakfast'));
localStorage.removeItem('lunch');
localStorage.clear();
document.cookie = "hello=true";
document.cookie = "doSomethingOnlyOnce=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
document.cookie = "person=beau; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/"
document.cookie = "person=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
console.log(document.cookie)
Cookies vs local storage vs session storage - Script Codes
Cookies vs local storage vs session storage - Script Codes
Home Page Home
Developer Beau Carnes
Username beaucarnes
Uploaded September 13, 2022
Rating 3
Size 2,167 Kb
Views 52,624
Do you need developer help for Cookies vs local storage vs session storage?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Beau Carnes (beaucarnes) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!