At this very moment, browser cookies have just invaded a small piece of your computer's memory. With all the stuff about GDPR and cyber-security being talked about all the time, you should know a little background for some of it. One thing you see a lot of is websites showing you what cookies they use on your computer. Cookies get a bad rep when you consider what get really are.
What are cookies
When people talk about cookies, they're talking about a small piece of text that gets saved on your computer. That's all. Now that text can be anything they want it to be, but usually you'll find stuff like user ids, setting parameters, and other information associated with your data.
They are the little pieces of information that keep you logged in on your favorite websites and show the custom settings you have. They're super common and you probably have hundreds of them in your browser right now. You could go and clear all of them but I hope you remember your passwords.
As soon as you clear your cookies, you'll be logged off of any sites you were logged on to and any custom settings you had will be gone. If you go back to that site though, all of those cookies can be set again.
How they work
One thing you'll be glad to hear is that a website is only allowed to look at its own cookies. So you don't have to worry about all of the websites you visit pilfering your information from other websites. This stops people from stealing your session information in particular.
Cookies aren't shared across browsers either. If you use Chrome, Firefox, and Safari, each one will have their own set of cookies. Everything is kept separately to help with the security of your data.
Uses for cookies
The biggest use for cookies is to hold your login state. This is how that little "keep me logged in" check box actually keeps you logged in. Information like your username and your page settings will be held as part of your login state.
There's a darker side to cookies. When it comes to tracking and advertising, some websites use iffy tactics. Advertising networks are all over the internet. Once your browser hits a website that's a part of an advertising network, a script is run and the network now knows where you've been online based on your cookies.
Another thing cookies are good for is showing you personalized content. That's how Netflix and Hulu are able to make suggestions on what you might like to watch. It's also how things like Facebook and Twitter can show you specific ads based on your browsing history.
How to manage your own cookies
Cookies aren't really that interesting to look at but you can go see what they look like in any browser. You can go to the browser settings and find the cookies and clear them or just see the values.
Most browsers will give you the option to block all cookies from all websites. Or you could block cookies from specific websites although some websites won't work correctly with the cookies disabled. In some cases, you can go in and edit cookies or add new ones.
You can see that cookies aren't as impressive as the news would have you think. They are important, but at the end of the day they are just lines of text. They can mess up your testing environment if you aren't using the right values though. Have you had any odd experiences with cookies?
Hey! You should follow me on Twitter because reasons: https://twitter.com/FlippedCoding
Top comments (1)
Cookies are typically pointers to a database record on the web server. That database record is typically a collection of pointers to all kinds of "deep background" about the client, some gleaned from direct interaction, some purchased from data vendors, etc. So while it's quite true that the cookie is a small piece of text, it's small size belies the web of highly detailed information that a cookie may bring up about a client.
Two related concepts are Web Storage and the IndexedDB. Both of these store much more expansive data sets on the browser. They can be used for client tracking, as well as providing a better offline experience.
en.wikipedia.org/wiki/Web_storage
en.wikipedia.org/wiki/Indexed_Data...