1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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.
    SEMrush
    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
    SEMrush
  2. Logic Ali

    Logic Ali Active Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #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 Active Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #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