Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interpreting Cookie Text...

Status
Not open for further replies.

rheilman

Programmer
Dec 6, 2002
51
0
0
US
I've been reading through the results of a search for the phrase "cookie text" and will now come right out and ask my question. I'm manipulating a file of cookies in IE that are meant to pass the settings of the current page on to the next page to produce similar filtering. I nave been successful in passing and applying most of these settings, but have run into a snag. Below is my cookie code (adapted from prior searches)...

Code:
function getCookie(name)
	{var arg = name + '=';
	var arglen = arg.length;
	var acookiejar = new Array();
	acookiejar = document.cookie.split('; ');
	var cookiecnt = acookiejar.length;
	var i = 0;	
	while (i < cookiecnt)
		{if (acookiejar[i].substring(0, arglen) == arg)
			{var thecookie = unescape(acookiejar[i]);
			var cookielen = thecookie.length;
			var thefilling = thecookie.substring(arglen, cookielen);
			return thefilling;}
		i = i + 1;}
	return null;}

function setCookie(name, value)
	{var yearsfromnow = new Date();
	yearsfromnow.setFullYear(yearsfromnow.getFullYear() + 20);
	expires = yearsfromnow;
	var curCookie = name + '=' + escape(value);
	document.cookie = curCookie;}

In trying to narrow down the problem on the unsuccessful instances, I have been looking at the contents of the cookie file in the cookie folder. Below is an example...

Code:
eacdreplevel
daterange
~~local~~/C:\Documents and Settings\RHeilman\Desktop\
1088
1186005248
31211962
53956688
29742447
*

eacdrepvalue
[Date Ranges End Points].[Since Last EAC]
~~local~~/C:\Documents and Settings\RHeilman\Desktop\
1088
1186005248
31211962
54056688
29742447
*

These two cookie entries are produced with the following code...

Code:
setCookie('eacdreplevel', eacdreplevel);
setCookie('eacdrepvalue', eacdrepvalue);

...where the nonquoted second argument of each function call is a variable supplied with the appropreiate value. In notepad, the <CR><LF> is displayed as a small portrait rectangle character and the cookie text is one contiguous line.

My question concerns the numbers that follow the cookie name, cookie value, and path. These change due to different factors that I am yet to understand. Can you explain what each part of the trailing numbers represent. I'm trying to determine if it's those trailing number differences that are causing my second page not to properly apply the cookie set down by the first page.

Thanks!
Ray <><

"I was going to change my shirt, but I changed my mind instead." - Winnie the Pooh
 
After some research, I find that the cryptic numbers at the end of each entry in the cookie file were not the problem. It would be academically satisfying to "know the code" concerning the subsequent numbers, but they were not the culprits in my problem.

My problem was caused by a parsing value placed in the "level" cookie.

Thanks!
Ray <><

"I was going to change my shirt, but I changed my mind instead." - Winnie the Pooh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top