473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

JavaScript cookies (in subdirectories) and PHP file

Dear Experts:

I have a problem with my JS cookies. I am setting cookies in files
located in two different directories, e.g. one in ROOT, one in
ROOT/dir1/dir2. The cookies are then sent to PHP file (server-side)
which writes their values to a textfile, e.g. OUT.txt.

The cookies that are in ROOT are working perfectly. No problem. The
cookies set in ROOT/dir1/dir2, however, "seemed" to be set and read
correctly, although
they are never written into OUT.txt in the server. I have used:

javascript.alert(document.cookie);

to make sure that all the cookies are set and read properly. They are
displaying correct cookie values. I have also set the path of cookies
in ROOT/dir1/dir2 to ROOT directory, e.g. path=/, making sure the
cookies are accessible from anywhere in the domain.

I am running out of ideas what may cause the problem and hope you
could help me.

Any help would be greatly appreciated.

Duane
Jul 20 '05 #1
1 2467

"duane" <du******@hotmail.com> schreef in bericht
news:59**************************@posting.google.c om...

I have a problem with my JS cookies. I am setting cookies in files
located in two different directories, e.g. one in ROOT, one in
ROOT/dir1/dir2. The cookies are then sent to PHP file (server-side)
which writes their values to a textfile, e.g. OUT.txt.

How do you write the cookies to the text file?
The cookies that are in ROOT are working perfectly. No problem. The
cookies set in ROOT/dir1/dir2, however, "seemed" to be set and read
correctly, although
they are never written into OUT.txt in the server. I have used:

javascript.alert(document.cookie);


Be aware that when testing cookies this way, they will be available before
the cookie header is send. This is because in JavaScript, 'document' is an
object and 'cookie' a property of this object.

In PHP, the cookie is available not sooner then after a reload of the page.
JW

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Taylor-Johnston | last post by:
I'm a University academic looking for a proper definition of JavaScript Cookies. http://www.CollegeSherbrooke.qc.ca/languesmodernes/604-HAE_Grammar_Practice/ I'm trying to decipher what...
7
by: Bert | last post by:
I have been reading the post and the FAQ and have been unable to find anything that will help with my problem. First let me say that I am not a web developer, designer and no next to nothing...
3
by: Magnus | last post by:
I have a iframe inside a main html file. The iframe is used to display various html files. Inside the html files displayed in the iframe I want to have javascript to set certain global cookies,...
3
by: Joel Byrd | last post by:
Using javascript to set cookies is apparently not working in Firefox. Here's a simple test page that works in IE, Opera, Netscape, but not Firefox (The javascript is right on the page): ...
1
by: FishKeeper | last post by:
I'm trying to write JavaScript code to test whether cookies are enabled by writing a cookie and then reading its value. My code works fine in Firefox, but it's not working in Internet Explorer 6. ...
2
by: rinku | last post by:
Hi, I am using smarty but I am unable to write javascript in tpl file ..If i write javascript then it gives error. How can i do it and how can i define a variable in .tpl file.
1
by: tyreejp | last post by:
can javascript access a file that has been posted to page via an HTTP POST?
3
by: DNK2007 | last post by:
Hi all Is it possible to add some entries in the firefox's cookies.txt file? Thanks DNK2007
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.