HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 9th, 2000, 04:48 PM
grahamli grahamli is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: UK
Posts: 12 grahamli User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi, I am writing a shopping cart program. I have a single cookie file which stores (1) items selected by the user during their browsing session and also (2) items "saved" by the user, so user can load it up when they do the shopping next time.

I want (1) to expire when the user exit the browser, and (2) to last permanently.

How can I achieve this with a single cookie file, or do I need two separate cookie files ? if so, how can I create two cookie files ?

any help much appreciated.

graham

Reply With Quote
  #2  
Old August 10th, 2000, 03:06 AM
MeijdenB MeijdenB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: Alkmaar, The Netherlands
Posts: 123 MeijdenB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>I want (1) to expire when the user exit the browser, and (2) to last permanently.[/quote]

You can do this in both ways. However you can do it best with setting 2 cookies. One with no expiration date so it will end at the browser session, and two with expiration date 5 years from now or something.


The other solution would be to have the one cookie while a person is visiting your site. As this person leaves remove the temporary data from the cookie and only keep the permanent data.

I would suggest setting 2 cookies by:

document.cookie = "name=value; expires=someTime;";

where someTime is build like this:

Wdy, DD-Mon-YY HH:MM:SS GMT e.g. Mon 14-Aug-00 12:00:00 GMT.



------------------
Good luck,
Bas

------------------
E-mail me at: b.vandermeijden@pecoma.nl

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > One Cookie file or Two Cookie files ????


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway