2021-09-07
2520
#vanilla javascript
Prateek Surana
65366
Sep 7, 2021 ⋅ 9 min read

A JavaScript developer’s guide to browser cookies

Prateek Surana I'm a frontend engineer currently building Devfolio who likes to build awesome products and write about React, JavaScript, and TypeScript.

Recent posts:

Why Frontend Devs Should Care About Platform Engineering

Why frontend devs should care about platform engineering

Learn how platform engineering helps frontend teams streamline workflows with Backstage, automating builds, documentation, and project management.

Muhammed Ali
Nov 3, 2025 ⋅ 6 min read
vercel ai elements featured image

How I built an AI productivity assistant with Vercel AI Elements

Build an AI assistant with Vercel AI Elements, which provides pre-built React components specifically designed for AI applications.

Emmanuel John
Nov 3, 2025 ⋅ 9 min read

How to use CSS line-clamp to trim lines of text

Master the CSS line-clamp property. Learn how to truncate text lines, ensure cross-browser compatibility, and avoid hidden UX pitfalls when designing modern web layouts.

Daniel Schwarz
Oct 30, 2025 ⋅ 3 min read
7 react Hooks you need to know

7 custom React Hooks every developer should be using

Discover seven custom React Hooks that will simplify your web development process and make you a faster, better, more efficient developer.

Murat Yüksel
Oct 30, 2025 ⋅ 8 min read
View all posts

4 Replies to "A JavaScript developer’s guide to browser cookies"

  1. Probably one of the best articles I have read! (in a long while)

    Good job and great explanation of how cookies defer from Local- & session storage. Learned a lot of new concepts here including security vulnerabilities regarding cookies and how to properly use cookie attributes.

  2. Thank you for this comprehensive article. Would you know if browsers, iOS Safari in particular, would start treating a cookie set in js as an http cookie if the server updates that cookie in a future request? For instance by changing the expiry date.

Leave a Reply

Would you be interested in joining LogRocket's developer community?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now