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 (35)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

July 4, 2009
US online advertisers scramble to avoid new privacy legislat...
WebDevTips UK
 
July 4, 2009
Massive Bank Fraud In EVE Online
WebDevTips UK
 
July 4, 2009
Amazon Wants Patent For Inserting Ads Into Books
WebDevTips UK
 
July 4, 2009
Mafia Wars Becoming "Cult Classic"
About
 
July 4, 2009
Facebook Privacy and Google
About
 
July 3, 2009
Why Freelancing is Awesome
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /JavaScript

Cookies with JavaScript 

  Views:    113928
  Votes:    2
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