Xhanch Forum

Development, Design, and Web Related Stuff => Programming => Topic started by: Xhanch Studio on May 19, 2011, 12:18:52 PM

Title: [What is] About web cookies
Post by: Xhanch Studio on May 19, 2011, 12:18:52 PM
Brief history of web cookies

Cookies were originally invented by Netscape to give 'memory' to web servers and browsers. The HTTP protocol, which arranges for the transfer of web pages to your browser and browser requests for pages to servers, is state-less, which means that once the server has sent a page to a browser requesting it, it doesn't remember a thing about it. So if you come to the same web page a second, third, hundredth or millionth time, the server once again considers it the very first time you ever came there.

This can be annoying in a number of ways. The server cannot remember if you identified yourself when you want to access protected pages, it cannot remember your user preferences, it cannot remember anything. As soon as personalization was invented, this became a major problem.

Cookies were invented to solve this problem. There are other ways to solve it, but cookies are easy to maintain and very versatile.


How cookies work

A cookie is nothing but a small text file that's stored in your browser. It contains some data:


As soon as you request a page from a server to which a cookie should be sent, the cookie is added to the HTTP header. Server side programs can then read out the information and decide that you have the right to view the page you requested or that you want your links to be yellow on a green background.

So every time you visit the site the cookie comes from, information about you is available. This is very nice sometimes, at other times it may somewhat endanger your privacy. Fortunately more and more browsers give you the opportunity to manage your cookies (deleting the one from the big ad site, for example).

Cookies can be read by JavaScript too. They're mostly used for storing user preferences.

Here are some cookies' properties:
Title: Re: [What is] About web cookies
Post by: lanham8darby on July 19, 2011, 07:46:53 AM
Interesting post. These is useful to me. I would like to know more about web cookies security. Could you please provide more information on it. Thanks in advance.
Title: What is About web cookies
Post by: Twestzevu on March 07, 2016, 05:32:36 PM
It is always good to learn a bit about web hacking and sql injection so you know how to code to avoid it.
Title: What is About web cookies
Post by: RolandGedo on March 28, 2016, 02:02:19 PM
I do know everyone is different when come coding whatever their programming language is

What Programming Language do you used?