Handy JavaScript Cookie Editor

2 years ago I wrote a small javascript to view, edit and delete cookies.

The really cool thing about this user interface is the inline editing of cookie names and values. I really like the principle that you hover the value that you inspect, can see that it’s editable. Then click directly and the text is converted to a text field that is automatically saved when you leave the field.

Andrei from New York wrote me and reminded me the handy little cookie editor, so after making some minor modifications, I decided to republish it.

Well, actually, I’ve spent some hours getting more and more puzzled on some bugs and limitations in the code.

I won’t hesitate anymore, but rather give you the tool including some known issues. Please feel free to make suggestions or fix.

Known issues:

All cookies set with the tool expires end-of-session. This could be easily fixed, but I’d like to implement it in a way so that it works elegantly and simple in the user interface.

Cookies with domain set differently cannot be edited or deleted. This is a problem on many big portal sites. For instance, all cookies on Yahoo! are set for .yahoo.com. But the front-page is located at www.yahoo.com (the www subdomain of yahoo.com), which means that my tool is not allowed to edit or remove the cookie.

Goto next page and bookmark this link in your browser: cookie editor page with bookmarklet.

Technorati Tags: , , , , , ,

9 Responses to “Handy JavaScript Cookie Editor”

  1. Jesper Rønn-Jensen Says:

    Hmm. Something went wrong as i posted. Probably because of single quotes or other “dangerous” signs in the bookmarklet.

    Looking through the source reveals some mysteries:

    First 3 single quotes are just fine. After that, every single quote is translated to &8216; and &8217;. The ending double-quote is then translated into &8221; which evenually breaks this post. I will reorder the post right now to it breaks less.

  2. Jesper Rønn-Jensen Says:

    Original source file available here:

    File with link you can bookmark:

  3. Thomas Baekdal Says:

    Does not work in IE7. The pop-up blocker stops it from opening :)

  4. Jesper Rønn-Jensen Says:

    I saw noticed the annoyance. And there should probably be an adjustment as to how the window is opened. Any ideas, suggestions, examples of what would work?

    Quick workaround is to “temporarily allow popups from this site” in the IE7 information bar.

  5. Thomas Baekdal Says:

    Instead of opening a window, one way might to add a DIV on the page that includes the information (and is placed above whatever is on the page).

  6. Jesper Rønn-Jensen Says:

    With respect to opening a new window, I prefer a cookie viewer/editor to live in its own window. Changes in cookies will affect all windows/sessions to the given website, so that’s why.

    Also I like that I can reload the webpage and keep the cookie window open. Which again are arguments for a seperate window for the cookie editor.

  7. Arjan Eising Says:

    Heey thanks! This bookmarklet just does what the Webdeveloper toolbar doesn’t…

  8. Jim Says:

    “Please feel free to make suggestions”

    I wrote a JavaScript cookie handling library that you could take a look at if you still felt your tool needed some corrections. While I don’t see anyway to overcome the cross domain restrictions, I think you could easily modify the cookie expirations.


  9. Louis Says:

    Hi Jesper

    Thanks for your great Bookmarklet, I’ve been collecting some for a few years but your’s is really useful.

    Here’s a question I am hoping you (or one of your readers) might be able to assist with:

    I’m running a blog which links to a referral program which uses a cookie:

    (where 11405 is saved as the cookie called “rewardcookie”)

    check it out with your cookie editor bookmarklet

    Is there a way for me to write this cookie while the user is reading my blog at wordpress or another blogging service (currently wordpress)
    before they visit http://www.ictel.co.za/11405 ?

    The reason that I ask is that I have seen a few people contacting me through my blog saying that they joined my “income network” , but in fact they did not.

    They read the blog and remembered the site ictel.co.za, and didn’t click through directly from my blog, thus not writing the reward cookie (dispite my best efforts to make them do so…)

    If I am able to push this rewardcookie from my different blogs about the service or possibly online adverts that would be great.

    Do you know if this is possible, and how this can be doen either in javascript or through a online ad?

    Any comments / or other methods as well as caveats about this approach will be much appreciated.