iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 9, 2008
Form Field Hints
EarthWeb.com
 
May 8, 2008
Meet The Hardy Heron: What's New in Ubuntu 8.04
OReilly Network
 
May 8, 2008
Does Enterprise Development Have to Be Painful? (Part Two)
OReilly Network
 
May 8, 2008
Perl Pragma Primer
WebReference.com
 
May 8, 2008
1 comment
.net
 
May 7, 2008
Poll: Do you check the download speed of the pages you build?
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /JavaScript

Cookies with JavaScript 

  Views:    90589
  Votes:    1
by Ahmad Permessur 10/08/06 Rating: 

Synopsis:

In this tutorial we will be able to handle cookies using JavaScript. We will implement both script and HTML page.
Pages: firstback2 3 forwardlast
The Article

Cookies

Since the HTTP (HyperText Transport Protocol) protocol cannot maintain user information, cookies are a solution to save useful client side data. The implementation varies on different browsers, but we decided to use the Netscape convention, because this great enterprise developed JavaScript. Netscape Navigator holds cookies in a text file called cookies.txt; otherwise, Microsoft Internet Explorer saves them into the Cookies folder. The implementation we present is Navigator and Explorer compliant.

Notice each cookie is attached in the cookies.txt file as a line and it has the following format

name=value;expires=expirationDate;

name is the name of the cookie and value, its value. expirationDate is an optional parameter, which indicates the cookie lifetime. expirationDate, if available, has the following structure

Mon, DD-MM-YY HH:MM:SS GMT

We use the toGMTString method, belonging to the Date object, to convert dates to this format. We remarked expirationDate is an optional parameter. When it is not set up, it is removed when user exits the current browser session. When its expiration date is explicited, cookie is not deleted until this date.Cookies

Pages: firstback2 3 forwardlast

Similar/related articles:


 
  Sponsors