Reading Cookies same domain?!

Discussion in 'JavaScript' started by LeftoverSoup, Apr 24, 2010.

  1. #1
    I've tried a lot of the cookie reading scripts out there, but I can't seem to find one that works.

    I know document.cookie only returns the cookies being used on the current page? but I need a function that will get a cookie from it's name, not in use on the current (set a few mins before on another page).

    Is this possible? Thanks in advance for any code you can provide.
     
    LeftoverSoup, Apr 24, 2010 IP
  2. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Set the cookie with 'path=/' or a path at the same level or higher than the location at which it will be read.
     
    Logic Ali, Apr 25, 2010 IP
  3. LeftoverSoup

    LeftoverSoup Guest

    Messages:
    95
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Could you provide an example of that in use?

    Thanks! :)
     
    LeftoverSoup, Apr 26, 2010 IP
  4. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #4
    How are you creating your cookie? If it's a function it must accept a path parameter. If you're coding the string manually, add:
    ;path=/
    Code (markup):
     
    Logic Ali, Apr 26, 2010 IP