- Cookies are small files that websites store on your computer to remember your information. Session data is a temporary conversation with a website, crucial for actions like shopping. Local storage is a folder on your computer where websites can store data for easier access, such as login information or preferences. These elements improve our interaction with websites, making the web more user-friendly.
Imagine a world where you have to log in to your favourite website every time you visit, even if you have just been there a few minutes ago. Or imagine a world where your shopping cart is emptied every time you close your browser, and you have to start adding items every time. That would be a frustrating world to live in, wouldn’t it?
The good news is that we don’t have to live in that world. Thanks to cookies, session, and local storage, websites can remember us and our preferences. But, how does the computer use these technology to remember our preference? Let’s see how, starting with the delicious cookies.
What are Cookies?
Cookies are small text files that are stored on your computer by websites that you visit (that’s right , they’re not the snacks you eat with warm milk). They’re like little sticky notes that websites leave on your computer so that they can remember you the next time you visit.
For example, when you log in to a website, the website stores a cookie on your computer with your login information. The next time you visit the website, the website can read the cookie and automatically log you in.
Cookies can also be used to track your browsing activity across different websites. Browsers can package this information, and it can end up being used by advertisers to target you with relevant ads. For example, if you’ve been visiting websites about hoodies, like I have, you may start seeing ads for hoodies on other websites that you visit. And if you visit adult sites, you know where this is going, right?
What are Session Data?
Session data is like a conversation that you have with a website. The conversation starts when you visit the website and ends when you leave the website or when you’re inactive for a certain period of time.
Session data is stored on the website’s server, not on your computer. This means that session data is lost when you close your browser or when you’re inactive for a certain period of time.
Session data is often used to store information that is needed for a single website visit, such as the items in your shopping cart or the progress you’ve made in a game.
For example, when you’re shopping online, your shopping cart is stored in a session. This means that you can add items to your shopping cart and browse the website without losing the items in your cart. When you’re ready to checkout, the website can read the session data to see what items are in your cart.
What is Local Storage?
Local storage is like a folder on your computer that websites can use to store data. Websites can access the data in the folder at any time, even when you’re not visiting the website.
Local storage data is stored on your computer, not on the website’s server. This means that local storage data is not lost when you close your browser.
Local storage is often used to store information that is needed for multiple website visits, such as your login information or preferences.
For example, when you log in to a website, the website may use local storage to store your login information. This means that you will not have to enter your login information every time you visit the website.
Now that you know a little bit more about cookies, session, and local storage, you can appreciate how they make our lives easier. They help us to log in to our favorite websites, keep track of our shopping carts, and save our preferences.
In short, cookies, session, and local storage are the delicious ingredients that make the web a more user-friendly place.