When you launch these browsers, some of them give you the option of restoring your previously open tabs. Why do I say “may”? Because there’s a hidden gotcha. At that point, the cookie may get cleared. It’s up to the browser itself to define what constitutes a “current browsing session.” In Chrome and Firefox, this is when you fully shut down your browser (i.e., close all tabs). These are known as session cookies, also called temporary cookies because they’re only kept around for your current browsing session. Notice that some cookies have Session as their value under the Expires / Max-Age column: There are two types of cookies that we’ll look at, each defined by its expiration/max age. These two attributes basically tell your browser for how long a cookie should be kept around. There’s another column in the table above that deserves our attention: Expires / Max-Age. For example, the cookie redesign_optout=true has a size of 19 because the combined character length of redesign_optout and true is 19. The size of a cookie is the total number of characters (bytes) in its name and value. Over on the far right, you’ll see a Size column. There are a few other cookies in the list, some of which are specific to my user profile and current browsing session. Since Reddit uses server-side rendering, the server needs to know which version of the Reddit interface a user wants to fetch: the old one or the new one. Its value is set to true here for my Reddit account because I prefer to use the old interface. For example, redesign_optout is one cookie in this list.
Notice how each cookie stores certain information identifying me as a user, as well as my preferences and settings to help the web server customize my user experience and the results returned in my Reddit feed. A cookie consists of a name, a value, an expiration date or “age,” a size in bytes, and so on. Here, Reddit is storing 15 different cookies. Each site may store zero or more cookies. True to its definition, a cookie is in fact “just a piece of data” stored on your computer. Here are the cookies associated with my Reddit account (I’ve intentionally obfuscated potentially sensitive values out of an abundance of caution): Click a domain that’s listed to view the cookies that are associated with it.įor the purposes of this tutorial, I’ll be using Reddit as an example.Navigate to the Application tab in Chrome ( Storage in Firefox and Edge).
Open your browser’s developer tools ( Ctrl+Shift+I on Windows / Cmd+Shift+I on Mac).And the best way to understand cookies is to actually look at one. Malware or spyware that’s listening to your activity.Ĭookies are literally inert pieces of textual data.
For example, when you loaded this page, your browser requested a bunch of different resources from my web server, such as the HTML document itself, its stylesheet, some JavaScript, images, and more. From a technical perspective, each page of a website corresponds to a different “resource” that’s hosted on a web server-a computer whose job is to listen for requests from a user’s browser and to respond accordingly.