greedyzebra
Technical User
My problem boils down to this. Why do I have a cookie that exists on only one page? Here are the details:
1) We start at the index page. onload we perform a function called "sniff" that creates a cookie that stores some environmental data (screen size, browser type). This has always created successfully. For what it's worth this is an .shtml page.
2) We move to another page where the "sniff" function is attempted again, but since the cookie it's meant to create already exists, it does nothing. For what it's worth, this too is an .shtml page.
3) We move to the third page (the problem page). I have an alert set up on entry to this and each of the pages accessed in the first two steps. In all cases, including now, the environmental cookie exists. When I initiate the action to create the new cookie (all this cookie stores is comma delimited numbers) it gets created and is visible with an appropriately placed alert. If I want I can then exit to the next page (whose output/displayed html is based upon the cookie data), or I can click on a few more things to add to the cookie. In either case the results are the same... I have an alert setup on "onunload" and the cookie and its data exists. For what it's worth this page is entirely generated by a Perl script in cgi-bin. That is, its url is For future reference, the name of this cookie is "rq".
4) We move to the fourth page which is, again, a .shtml file with the ssi call being to a Perl script that grabs the data for the cookie that was created on the previous page (in the previous step). I have the script print out all cookies in html comments. The enviornmental cookie is there, but the cookie created in step three is not. Nor does it show up in the onload-generated alert.
5) I can travel around to other pages within my site and the cookie generated in step 3 is never seen by the alerts. But the enviornmental cookie (which even though the function to create is called on every page, is still created only in step 1) is there. If I go back to the page where my "user-defined" cookie was created in step three, it shows up in the alert!
So, again, the bottom line is that the cookie is only visible on the page where it was created.
Some random notes:
*The same function is used to create the enviornmental cookie and the "step 3" cookie.
*I've modified the "sniff" function that's called on each page to create a non-valued "rq" cookie. This cookie without value can be seen everywhere the environmental cookie can be seen. When I supposedly add to the cookie in step 3, two cookies named "rq" exist in the document.cookie alert. However, only the non-valued "rq" exists everywhere.
*The cookie data is "escaped" before being added to document.cookie
*The cookies are good only for the session so the only data that exists in them are the name and its subsequent values. So it's not an expiration issue or a domain issue.
*The code for the cookies has worked before. I have actually made no modifications on the particular functions dealing with the cookie creation and editing. I have made changes to the script that produces the page in step 3, but there is no difference in the function call to the "setCookie" function.
I am delighted to post code if necessary, but given how long-winded this explanation is so far, I don't want to make it longer and turn away any potential helpers. So if you need it, I'm happy to post it. I've worked on this for a couple of days now, obviously without success, so any suggestions are greatly appreciated!
Thanks!
1) We start at the index page. onload we perform a function called "sniff" that creates a cookie that stores some environmental data (screen size, browser type). This has always created successfully. For what it's worth this is an .shtml page.
2) We move to another page where the "sniff" function is attempted again, but since the cookie it's meant to create already exists, it does nothing. For what it's worth, this too is an .shtml page.
3) We move to the third page (the problem page). I have an alert set up on entry to this and each of the pages accessed in the first two steps. In all cases, including now, the environmental cookie exists. When I initiate the action to create the new cookie (all this cookie stores is comma delimited numbers) it gets created and is visible with an appropriately placed alert. If I want I can then exit to the next page (whose output/displayed html is based upon the cookie data), or I can click on a few more things to add to the cookie. In either case the results are the same... I have an alert setup on "onunload" and the cookie and its data exists. For what it's worth this page is entirely generated by a Perl script in cgi-bin. That is, its url is For future reference, the name of this cookie is "rq".
4) We move to the fourth page which is, again, a .shtml file with the ssi call being to a Perl script that grabs the data for the cookie that was created on the previous page (in the previous step). I have the script print out all cookies in html comments. The enviornmental cookie is there, but the cookie created in step three is not. Nor does it show up in the onload-generated alert.
5) I can travel around to other pages within my site and the cookie generated in step 3 is never seen by the alerts. But the enviornmental cookie (which even though the function to create is called on every page, is still created only in step 1) is there. If I go back to the page where my "user-defined" cookie was created in step three, it shows up in the alert!
So, again, the bottom line is that the cookie is only visible on the page where it was created.
Some random notes:
*The same function is used to create the enviornmental cookie and the "step 3" cookie.
*I've modified the "sniff" function that's called on each page to create a non-valued "rq" cookie. This cookie without value can be seen everywhere the environmental cookie can be seen. When I supposedly add to the cookie in step 3, two cookies named "rq" exist in the document.cookie alert. However, only the non-valued "rq" exists everywhere.
*The cookie data is "escaped" before being added to document.cookie
*The cookies are good only for the session so the only data that exists in them are the name and its subsequent values. So it's not an expiration issue or a domain issue.
*The code for the cookies has worked before. I have actually made no modifications on the particular functions dealing with the cookie creation and editing. I have made changes to the script that produces the page in step 3, but there is no difference in the function call to the "setCookie" function.
I am delighted to post code if necessary, but given how long-winded this explanation is so far, I don't want to make it longer and turn away any potential helpers. So if you need it, I'm happy to post it. I've worked on this for a couple of days now, obviously without success, so any suggestions are greatly appreciated!
Thanks!