web blazonry web development scripts and tutorials Get best price on Unlocked Moto G Stylus
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   

Javascript Home


image scripts
  Image Load Order
  Mouse Overs
  SlideShow

JavaScript Resources
  Free JavaScript Books(new)
  Recommended Sites
  Bestselling Books

Bookmark and Share




JavaScript: How to Work With Cookies

Here is a tutorial on how to save (create), retrieve and delete cookies using JavaScript. These functions are all you need to use cookies on your web site. As always, includes all source code.

Tutorial Sections

Overview of Cookies

A cookie lets you store a small amount of information about a user visiting your site. A cookie is a small text file that is stored on the site visitor's computer by their browser.

Because the cookie is stored on the user’s computer, it does not require any server space no matter how many users you have.

You can use cookies to save user preferences, customize data, remember the last visit, or to keep track of items in an order while a user browses. Cookies can help give a personal touch to your site by remembering the information your site’s visitors gave last time.

My article about cookies in the "How Tos" section provides more detail and background about cookies. It also discusses issues regarding the safety and security of cookies.

Viewing Cookie Files With Firefox
When programming cookies, you will want check that the contents of your cookie file are set the way you intend. I prefer viewing cookies with Firefox browser ( .)

To view your cookie, follow these steps (correct for Firefox version 1.5). You will have do some of these steps only once. Firefox will return you to these options the next time you go down this path. On the Firefox menu, select Tools, Options..., Along the top, select Privacy. In the row of tabs, select Cookies. Towards the left bottom, click the button that says View Cookies. You will see a list of cookies stored on your computer. After you complete this tutorial about cookies, you should have a cookie for the site “localhost” that you can open and view.

Firefox also makes it easy to delete your cookie so you can create your cookie again after making some programming changes.

Viewing Cookie Files With Internet Explorer
To see your cookie files on Microsoft Internet Explorer, launch Windows file explorer. Find C:\Documents and Settings\YourUserName\Cookies. Sort the files in this directory by Date Modified to find the cookie you are working with. You should see a cookie file with the name in the form "yourname@localhost.txt" Double click the filename to open it and view the contents. You likely have to turn on word wrap (Format | Word Wrap) in Notepad or your default text editor.


Next >> Saving a Cookie

 

Related Links:

    Cookie Central -- a site devoted completely to information about cookies.

 

Newest Pages
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2016. astonishinc.com   All Rights Reserved.