Subcookies V2

Posted on 09 May 2008 (02:47 PM)

My Subcookies article from May the 27th of last year has proven to be my most popular bit of writing.

A year after publishing, "C" has requested an update.

I have now rewritten my cookies script, fixing some issues pointed out by "C", and added some security as pointed out by Jim Thomson.

Notable changes:

Note; for a complete rundown of the original script, read Subcookies.

Other changes consist purely of improving some code, comments and security checks.

So, the new version can be downloaded here. Go and grab it, it's free!

As always, I'd love to hear feedback. If you have any, do let me know.
And C, sorry to keep you waiting ;).

Back to top

Filed under Javascript

Comments:

  1. 09 May 2008 (05:39 PM) by C

    OMG!! I love you man!! I really do! : )

    ''

    And C, sorry to keep you waiting ;)

    "

    It worth all the waiting! ; )

    this comment has been quoted by Harmen Janssen

  2. 09 May 2008 (06:12 PM) by Harmen Janssen

    C wrote:

    OMG!! I love you man!! I really do! : )

    ''

    And C, sorry to keep you waiting ;)

    "

    It worth all the waiting! ; )

    Good!

    I'm glad you're satisfied with my update. :)

  3. 23 June 2008 (01:07 PM) by Lesley Regan

    I love the names in your code. bake. crumble. cookiejar. The code is awesome, too. Good point about the subcookie separator.

    Thank you! lesley

  4. 14 July 2008 (06:36 AM) by Sean

    I am having problems with the fetch portion of this script.

    I am receiving errors, '{cookiename} is null' when trying to fetch a cookie. When looking at the cookiejar object, I see there is code to prevent errors for both a cookie, and it's subcookies when they don't exist, but I still receive the error.

    Any ideas?

    this comment has been quoted by Harmen Janssen

  5. 15 July 2008 (09:13 AM) by Harmen Janssen

    Sean wrote:

    I am having problems with the fetch portion of this script.

    I am receiving errors, '{cookiename} is null' when trying to fetch a cookie. When looking at the cookiejar object, I see there is code to prevent errors for both a cookie, and it's subcookies when they don't exist, but I still receive the error.

    Any ideas?

    Sean, the cookiejar object returns null when no cookie with the specified name is found.

    Is this the reason of your error, or does the error really happen inside the function?

    If you have the Web Developer Toolbar installed (Firefox extension), you can see what cookies are in place on a certain website, have you checked if the cookie's really there?

  6. 03 December 2008 (01:11 AM) by koya

    hey,

    excellent code... it does have a problem like Sean is saying...

    This always returns NULL for this line:

    if (subcookieName in cookieObj)

    I can see the sub cookie name using a Firefox plugin inside the main cookie and it looks correct. The cookie name does exist so it can't be that.

    I am starting to think that it is the "in" operator... Thoughts????

    Thanks

Leave a comment

RE: Subcookies V2

Note to spammers: rel="nofollow" will be added to links. If I consider your comment spam, your IP-address might get blocked.

HTML not allowed. URLS will be auto-linked. Maximum length is 1250 characters.

I understand this is inconvenient, but the spam I'm receiving on this website is driving me nuts. Please forgive me and cope with it until I find a better solution.

Mandatory fields are marked by an asterisk (*).

Increase textarea-size Decrease textarea-size

Back to top

Preferences

These settings will be saved for your convenience.