Categories:
Partners

Session-only cookies

Preheat your oven people, for the time has come to thrust JavaScript into it until some long term memory develops. In this tutorial, we'll look up the recipe for session-only cookies, and how they can help your scripts retain information even after the page is reloaded or cleared.

Brief overview

JavaScript cookies are the vehicle to persisting data between client requests. When a site requiring login remembers your username on return visits, for example, thank not Oreos, but these uneatable imposters.

There are two types of JavaSript cookies- permanent, and session-only. The first one stores its information in a physical file on the client's computer called "cookie.txt", with the stored data "permanently" available. Session only cookies, on the other hand, stores information in the browser memory, and is available for the duration of the browser session. In other words, the data stored inside a session cookie is available from the time of storage until the browser is closed. Moving from page to page during this time does not erase the data.

This tutorial, as mentioned, focuses on session only cookies. Empty your stomach as we dive into em'!