I received a question from Nola in New Zealand. She wanted to know about cookies, and she wrote:
Could you please tell me a little about cookies. if a cookie is classed as na is that safe to leave on the computer. I am fairly new to all this. thanks for your help regards nola
So, what is a cookie?
Cookies are small text files that are created by web sites. The web site sends it to your computer as it sends the web page or a graphic or any other type of response. Cookies are normally encrypted so that they can not be intercepted or changed.
Your web browser stores the cookie on your hard drive. The next time you connect to that web site, your web browser sends the cookie back as part of the request for a new web page. This happens whether “the next time” is a few seconds later, a few hours later or a few days later.
The main complication of the World Wide Web is that each connection to get a web page’s HTML code or a graphic on a web page is actually a separate, unrelated connection as far as the web servers are concerned — a separate request from your computer to the web site.
It’s not like using a telephone. We make a connection to a web site, get the HTML code of the page and then the connection ends. Unlike when we use the phone to call to a friend, the connections between your web browser and the web site do not continue until you hang up(or leave the site).
The HTML has, within it, more code to tell your web browser to request additional items such as images. The HTML tells your browser "now request THIS picture from THIS URL (Uniform Resource Location — it’s address on the Web). This request is another separate connection request — in networking terms, a new TCP/IP connection.
Each connection, each request for some independent piece of information for a web page, that your web browser makes to a web site includes some routine information: your IP address (so the web server knows where to send the response) and information identifying your web browser and version in case the web server wants to send a customized version.
So, why is the cookie needed?
Simply, a cookie enables the receiving web site to remember that you are the person who was previously connected to the web site. That enables it to pass any needed continuity information from page to page.
If the site knows who you are, that is, if it requires you to log in, it may give you the option to automatically log in on future visits. If so, it uses a cookie to store and provide that information.
Cookies are also used in advertising, which is what makes information free on the web. When you click on an ad, you get a cookie set by the advertising network, which tracks which web site had the ad.
In today’s web world, sites are paid for actions taken by visitors they refer — for clicks in the case of some ad programs (like some of Google’s ads) or for actual sales resulting from clicks on the web site’s ads. Of course, if you clear cookies or don’t allow cookies to be set, the web site operator misses the ad income if a sale was required.
If a site does not know who you are, but still has data that is important to carry from one web page to another, the site usually does that with either a regular cookie or one of the newer type "session cookies."
Web browsers send cookies back to the domain that set the cookie. The site originally creating the cookie can set that the cookie is to be presented to only that one specific site in the domain (such as www.google.com ) or to any site in the domain (such as blogsearch.google.com , as well as to www.google.com ). That’s the key to cookies — browsers only send a cookie to web servers in the domain that set the cookie.