Results 1 to 3 of 3

Thread: Help with reading cookies

  1. #1
    Join Date
    Dec 2009
    Location
    North Carolina
    Posts
    71
    Thanks
    13
    Thanked 3 Times in 3 Posts

    Default Help with reading cookies

    Well, I used to be able to. Now I can't. I read the tutorial that taught me the first time and I just can't make it work. Could anyone give a me a refresher on how to READ cookies with JavaScript? Keep it simple if you can haha. Thanks!
    Last edited by twQ; 12-29-2009 at 04:46 AM. Reason: Changed wording. JavaScript doesn't have special cookies...

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The simple answer is:

    Code:
    alert(document.cookie);
    That will give you all of the javascript cookie info for that page. You can parse it any way that you like. Here's my unit (gleaned from the work of many others, then condensed - there are other cookie units out there) that works for most situations:

    http://www.dynamicdrive.com/forums/blog.php?b=32
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    twQ (12-29-2009)

  4. #3
    Join Date
    Dec 2009
    Location
    North Carolina
    Posts
    71
    Thanks
    13
    Thanked 3 Times in 3 Posts

    Default

    Thank you for that, and I'll use your code for now but I'm going to try to learn how to do it on my own again I always feel like I'm stealing if I use a script that I don't understand...and since I don't remember how to read cookies I don't understand it haha. Thank you for the script I should be able to figure what I need from it.

Bookmarks

Posting Permissions

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