Logo

dev-resources.site

for different kinds of informations.

Limitations of Cookies

Published at
2/6/2024
Categories
cookies
learning
ruby
Author
jeeheezy
Categories
3 categories in total
cookies
open
learning
open
ruby
open
Author
8 person written this
jeeheezy
open
Limitations of Cookies

When I was working on my PokeLucky application (https://github.com/jeeheezy/sinatra-pokelucky), which interacts with the PokeApi, I tried to respect the PokeApi rule to cache information so there wouldn't be too many repetitive API calls. Since I was unfamiliar with how to cache information, I decided I'd just store the necessary data I got from the API into cookies to call back a later time. All was working fine until at a certain point, I got an error saying that I was trying to parse a nil object. Taking some time to debug, I found out it was because my conditions which look at if a Pokemon info was saved on a cookie did not take the expected "if" condition.

The core of the issue was that at a certain point, my cookie did not update with the latest information from the API because it had gotten too big. It seems that cookies have a byte limit of ~4000 bytes, which is not a lot. Even more to consider is that the best practice is to ensure the total bytesize of cookies doesn't exceed ~4000 per domain, not per cookie. I guess this is why learning how to use sessionStorage or localStorage is important since their storage capabilities are far greater than that of 4kb of cookies, although I'm not sure how one would access them in Ruby since I understand the two storages to be more front-end related.

TL;DR, cookies have bytesize limit and should not be the primary location to save continuous influx of data.

cookies Article's
30 articles in total
Favicon
Cookies auto clearing after browser refresh issue , CORS related express cookies issue
Favicon
Understanding Cookies in Rails: A Developer's Guide
Favicon
Understanding JWT Tokens vs. Session Cookies: The Best for Web Authentication
Favicon
How to use Cookies in Postman?
Favicon
Comprehensive Guide to Cookies in JavaScript
Favicon
Understanding Cookies: What They Are, How They Work, and Why They Matter for Your Privacy
Favicon
What Cookies are Important for Privacy?
Favicon
Making the most annoying cookie banners we could think of 🍪🤬
Favicon
The Most Annoying Cookie Banner Ever Hackathon 🤬🍪
Favicon
How to Set Up User Cookies and Connect Google Analytics in Your React App
Favicon
Cookie Consent Headaches Across Subdomains
Favicon
Hacking Cookies and PWA on Ubuntu
Favicon
Third-Party Cookies Are Gone (Or Not). How Can I Still Embed Cross-Site Apps?
Favicon
🍪 Cookies - A humbling auth experience
Favicon
Javascript Ls/ss/cookies
Favicon
Contextual Targeting vs Cookies: Who will win in 2024?
Favicon
Javascript Ls/ss/cookies😎
Favicon
Introduction to JWT and Cookie storage
Favicon
Demystifying Session-Based Authentication: Your Angular Roadmap
Favicon
How to persist client-side preferences on the client in Svelte (w/o DB)
Favicon
Cookies in Depth using Javascript and NodeJs
Favicon
Cross-Domain Tracking Implementation
Favicon
Double chocolate chip cookie
Favicon
Mastering Authentication & Authorization: Exploring Identity Framework with .NET 8 and Migrations
Favicon
Elixir - Simple Req Cookie Jar
Favicon
Limitations of Cookies
Favicon
Cookies vs Session Storage vs Local Storage
Favicon
Best DX for cookies on localhost
Favicon
Understanding Cookies and Sessions in Node.js
Favicon
Cookies

Featured ones: