JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

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 October 29th, 1999, 09:34 PM
Aaron Moore
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Im in the process of finishing up a script that stores cookies of items that users have selected from a page. On one page of the site, The cookies are retrieved, and are set into a textbox. Anyways, For some reason, I can only store 20 cookies. I know that you can store like 300 something into a file, but for some reason it stops at 20. When I select more than 20, it adds them to the cookie file, and over-writes the last 20...
Can ANYONE help out??? I know the code isnt restricting it from writeing them (atleast i think not). Could it be cause Im viewing the page on my DASD? I havent published it to the net yet to test it. I dont see why that would make a dif. Thanks.

------------------
Aaron M.
The Power Company
Internet Design/Hosting/Marketing
http://www.thepowercompany.org

Reply With Quote
  #2  
Old March 9th, 2001, 01:20 PM
clunday clunday is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 1 clunday User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Aaron,
There is a limit to the number of cookies that a browser will accept from a domain. That limit is 20. Each cookie can be up to 4k in size, so you will want to maximize the amount of data that you place in each cookie such as:

document.cookie="cookie_1=username:speedy/first_name:Ralph/last_name:Jones/address:1234 Evergreen Circle/city:Plano/state:TX/zip:75075";//This could go on and on for up to 4k of info

perhaps on another page
document.cookie="cookie_2=more_name_value_pairs:various_values";//again use up to 4k

Here is a function I use to get all of my cookies and place them into a two diminsional array so that the values can be accessed as follows:

my_cookie = getcookies();

alert("Your name is " + mycookie["cookie_1"]["first_name"]);

function getcookies(){

var arr = new Array();
var the_cookies = document.cookie;
var raw_cookies=the_cookies.split("; ");
for (x=0;x<raw_cookies.length;x++){
var tmp_arr= new Array();
var tmp_raw_cookies = raw_cookies[x].split("=");
var tmp_cookie_names = unescape(tmp_raw_cookies[1]).split("/");
for (y=0;y<tmp_cookie_names.length;y++){
var tmp_cookie_vals = tmp_cookie_names[y].split(":");

tmp_arr[tmp_cookie_vals[0]] = tmp_cookie_vals[1];

}
arr[tmp_raw_cookies[0]] = tmp_arr;
}
return arr;
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > JavaScript Cookies

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

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