j_ford
01-05-2004, 01:23 PM
Hi, all:
Newcomer to the forum.
In a localhost web app, I have set a cookie on page 1 and am trying to read it in page 2. It's not working.
Page one calls this JavaScript function:
function doChoice(project, choice)
{
if(choice == "configure")
{
document.cookie = "current_project=" + project + "; path=/";
}
}
Page two includes this:
<script language="JavaScript">
<!--
var cookies = document.cookie;
var search = "current_project=";
var start = cookies.indexOf(search);
...
-->
</script>
But cookies is always an empty string when read from page 2, and so start always shows as -1.
I've tried setting the cookie with and without "path=/" but it doesn't work either way.
I'm using a Mozilla 1.5 browser on a Red Hat 9.0 Linux box; webapp is deployed in a Tomcat web server. Access is through Apache using mod_jk.
Mozilla's cookie manager shows current_project as a valid cookie, with content.
Any ideas what's wrong?
Thanks.
Jerry
Newcomer to the forum.
In a localhost web app, I have set a cookie on page 1 and am trying to read it in page 2. It's not working.
Page one calls this JavaScript function:
function doChoice(project, choice)
{
if(choice == "configure")
{
document.cookie = "current_project=" + project + "; path=/";
}
}
Page two includes this:
<script language="JavaScript">
<!--
var cookies = document.cookie;
var search = "current_project=";
var start = cookies.indexOf(search);
...
-->
</script>
But cookies is always an empty string when read from page 2, and so start always shows as -1.
I've tried setting the cookie with and without "path=/" but it doesn't work either way.
I'm using a Mozilla 1.5 browser on a Red Hat 9.0 Linux box; webapp is deployed in a Tomcat web server. Access is through Apache using mod_jk.
Mozilla's cookie manager shows current_project as a valid cookie, with content.
Any ideas what's wrong?
Thanks.
Jerry