HighDots Forums  

Forcing document to submit cookies

Javascript JavaScript language (comp.lang.javascript)


Discuss Forcing document to submit cookies in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
duane
 
Posts: n/a

Default Forcing document to submit cookies - 09-20-2003 , 07:27 PM






Dear Experts:

I have a problem.

When you enter the website I am working on, wherever you go within the
website, the URL address on the website will display:
"http:\\..\index.html", whether you go to "Page1.html", "Page2.html",
etc. The cookies in every page is set on "<BODY onLoad =
"setCookie();">. Except for index.html, all the cookies are set and
written to a textfile correctly in the server. All cookie values in
every page in the website are written to a textfile in the server by
using the SAME PHP script.

My question is: Why is the cookie set in index.html not written to a
textfile in the browser? Is it because of the fact that index.html is
considered to never finish loading because it is the page that always
gets displayed on the URL? Is there a way to force the document to
submit cookies in "index.html" to the server without the user knows
anything about it?

The method that I am using right now is by creating an image object,
e.g. img = new image();, and set image.source to be some PHP file that
will process values of cookies submitted. This works correctly for
most pages but all for one page, e.g. index.html.

duane

Reply With Quote
  #2  
Old   
Ivo
 
Posts: n/a

Default Re: Forcing document to submit cookies - 09-21-2003 , 05:49 AM






"duane" <duawaktu (AT) hotmail (DOT) com> wrote

Quote:
website, the URL address on the website will display:
"http:\\..\index.html", whether you go to "Page1.html", "Page2.html",
I assume you achieve this with a "100%,0%" frame. Unnecessarily complicating
most of the time.

Quote:
etc. The cookies in every page is set on "<BODY onLoad =
"setCookie();">. Except for index.html, all the cookies are set and
written to a textfile correctly in the server. All cookie values in
every page in the website are written to a textfile in the server by
using the SAME PHP script.

My question is: Why is the cookie set in index.html not written to a
textfile in the browser?
No idea. Perhaps post some example code.

Is it because of the fact that index.html is
Quote:
considered to never finish loading because it is the page that always
gets displayed on the URL?
Try onload="alert()"

Is there a way to force the document to
Quote:
submit cookies in "index.html" to the server without the user knows
anything about it?
Cookies are stored on the client side. Forms are submitted to the server.

Quote:
The method that I am using right now is by creating an image object,
e.g. img = new image();, and set image.source to be some PHP file that
will process values of cookies submitted. This works correctly for
most pages but all for one page, e.g. index.html.
Type
javascript:alert(document.images.length)
in the address bar and verify the number.
If that is correct, and the php image is the last image on the page,
javascript:alert(document.images[document.images.length].src)
or, if it is the first
javascript:alert(document.images[0].src)
That should give you some clues.
HTH
Ivo

Quote:
duane



Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.