Course contentsShow
← Web Development
Lesson 2236 of 2,98240. Browser DevTools Deep DiveFree lesson

Cookie Management and Debugging

Inspect cookie attributes (domain, path, expiry, secure, SameSite), edit values, and understand cookie visibility rules.

Cookie Management and Debugging

You'll learn how to inspect, modify, and understand cookie behavior using browser DevTools to debug authentication, tracking, and state issues.

What Are Cookies and Why Debug Them?

Cookies are small text files stored by your browser that websites use to remember information between visits—login sessions, preferences, shopping carts. When cookies misbehave (wrong domain, expiring too soon, not sending on requests), your app breaks. DevTools lets you peek inside.

Key Cookie Attributes

Each cookie has metadata that controls when and where it's sent:

  • domain: Which domain(s) can read this cookie (e.g., .example.com works for all subdomains)
  • path: Which URL paths get the cookie (e.g., /app only sends to /app/*)
  • expiry: When the cookie auto-deletes (Session cookies vanish when you close the tab; Max-Age/Expires set specific dates)
  • Secure: Only send over HTTPS connections
  • SameSite: Controls cross-site request behavior (Strict, Lax, None) to prevent CSRF attacks

Inspecting in Application Panel

Navigate to Application > Cookies in DevTools. You'll see a table listing all cookies for the current origin. Click any row to view its attributes. Notice how Secure cookies won't appear if you're on http://, and SameSite=Strict cookies won't send on cross-site requests.

Editing and Testing

Double-click any value to edit it live—useful for testing different session IDs or flag values. Right-click to delete individual cookies or clear all. This is invaluable when debugging "why isn't my auth token working?" issues.

Visibility Rules Matter

A cookie set with domain=subdomain.example.com won't be readable by example.com. A path=/admin cookie won't send to /. Understanding these scoping rules explains why your requests might be missing expected cookies.

Key Takeaway:
DevTools' Application panel lets you inspect every cookie attribute, edit values on the fly, and understand domain/path/security rules that control when cookies are sent—essential for debugging authentication and state issues.