Web Development

  Homes arrow Web Development arrow How to Use Cookies Part 1
 Webmaster Tools
Base64 Encoding 
Browser Settings 
CSS Coder 
CSS Navigation Menu 
Datetime Converter 
DHTML Tooltip 
Dig Utility 
DNS Utility 
Dropdown Menu 
Fetch Content 
Fetch Header 
Floating Layer 
htaccess Generator 
HTML Encoder 
HTML Entities 
IP Convert 
Meta Tags 
Password Encryption
Password Strength
Pattern Extractor 
Ping Utility 
Pop-Up Window 
Regex Extractor 
Regex Match 
Scrollbar Color 
Source Viewer 
Syntax Highlighting 
URL Encoding 
Web Safe Colors 
Forums Sitemap 
Weekly Newsletter
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
  >>> SIGN UP!  
  Lost Password? 

How to Use Cookies Part 1
By: Developer Shed
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0

    Table of Contents:

    Rate this Article: Poor Best 
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article




    How to Use Cookies Part I By William Bontrager

    This article describes how cookies work and ways cookies can be used for your benefit, as a webmaster, without compromising your visitor's privacy.

    The second article in this series will show how to use cookies with JavaScript. And the third article will do that with Perl CGI programs.

    If you're an experienced programmer (or brave :-), you can go directly to Netscape.com's preliminary cookie specifications page. Otherwise, use it as a reference after you have more understanding about cookies and how you want to use them. The page is at http://home.netscape.com/newsref/std/cookie_spec.html

    Cookies are benign text data records stored on your visitor's hard drive. According to the specifications, the only internet site able to retrieve a cookie from that hard drive is the site that put it there in the first place.

    Cookies are not programs. They are plain text data.

    Cookies can not gather information on their own. The data cookies contain has been gathered by other means. And cookies can not collect personal information about your visitors from their computer.

    Cookies allow your site to store information on your visitor's computer for later retrieval.

    Why Sites Use Cookies:

    When your visitors surf your site, they go from page to page. Ideally, it is a smooth, continuous experience.

    For your server it is not that way. During the time between when one of your visitors arrives at pageD.html and decides to click to pageR.html, there may have been dozens of other visitor browsers retrieving those same and other pages. Once your server delivers a page to a browser, it disconnects from the browser.

    There is no automatic method of remembering information from one page to the next.

    In many situations, using cookies is the most efficient method of remembering and tracking preferences, purchases, commissions, and other information required for better visitor experience or site statistics.

    How It Works:

    Your server sends some data to the visitor's browser in the form of a cookie. (The exact format will be discussed later.) The data is plain text.

    The browser may accept the cookie. If it does, it is stored as a plain text record on the visitor's hard drive.

    Now, when the visitor arrives at another page on your site, the cookie is available for retrieval. Once retrieved, your server knows/remembers what was stored.

    Cookies have specific size limits:
    1. A cookie may be no larger than 4k.
    2. There may be no more than 20 cookies per domain.
    3. There may be no more than 300 cookies total from all sources.

    (Note that browsers are not required to conform to those limits. They may allow more or larger cookies. However, responsible programming requires respect for the specifications.)

    If your server asks a browser for cookies it may have accepted while at your site and none are available, either

    ~~ the visitor has never been at your site,
    ~~ the browser did not accept cookies your server offered,
    ~~ in order to stay within the 300 cookie limit, the browser deleted your domain's cookie(s) from the hard drive when accepting cookies from other sites, or
    ~~ the visitor manually deleted your server's cookie(s) from the hard drive.

    Continue: Page [2]


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Web Development Articles
    More By Developer Shed



    - On Page SEO for New Domains
    - Improve Your Site`s Speed
    - Safari Books Online Review
    - Creating an Estore From the Ground Up
    - Most Common SEO Mistakes Developers Make
    - Making the Most of Your Titles and Meta Desc...
    - Five Ways Using Flash Can Damage Your Site
    - A Web Designer`s Guide to Colors
    - Use Webstarts to Create a Free Site
    - More Than Just Looks. How Your Web Design C...
    - How to Design Content Pages
    - Mint Review
    - Make Your WordPress Website Look Professional
    - How to Create a Mobile Web Site
    - Meta Tags: Still Useful?

    Developer Shed Affiliates


    © 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap