Cookies and Contacts

As everybody and their mom has been talking about Greasemonkey and AJAX, I decided I had better get a piece of the action. I also had a growing annoyance with the state of MUAs. I was contemplating writing my own, however I’ve since realized that perhaps I can get what I want by using Greasemonkey to add features to Gmail. Persistent Persistent Searches is that first step. The bit of code that I wrote allows people to write Greasemonkey scripts that store data in a Gmail contact. I wanted it to be relatively secure, “nice” to Gmail’s servers, and easy to use. What I ended up with is something that stores data in the note field of a particular contact. The data resembles cookie data and can be used in a very similar fashion. In fact the note data is cached in a cookie. This is my attempt to be nice to Gmail’s servers. On initial login, the note data is downloaded from the contact and stored in a cookie. Any read attempts for note data actually just read the local cookie. Any write attempts change the data in the local cookie and on Gmail’s servers. Since this data is cached in a cookie, I was a little concerned with the expiration time of this cookie (so that other users on the same computer couldn’t see the cookie data). The pseudo-solution was that this cache cookie expires after 3 minutes. However, Gmail checks for new mail every 2 minutes. Each time this happens (and the same user is logged in), the cache cookie will be given another 3 minutes to live. In other words, this cache cookie will be around after the user logs out of Gmail for at most 3 minutes.

5 Comments »

  1. Anonymous said,

    May 26, 2005 @ 6:23 am

    Am I correct in thinking your RSS feeds aren’t working? I get a 404 and Bloglines fails to find them.

    –Phil.

  2. Luke said,

    May 27, 2005 @ 8:45 am

    They should work. What URL do you get a 404 on? These seem to work:
    http://lukebaker.org/feed/atom/
    http://lukebaker.org/feed/rss/
    http://lukebaker.org/feed/

    It looks like the comments feed (http://lukebaker.org/feed/atom/) isn’t valid. I’ll see if I can figure that out.

  3. Luke said,

    June 9, 2005 @ 1:38 pm

    Actually, you were right, Phil. My feeds were returning 404s, but they were returning the correct content, which confused me. It is fixed. Thanks!

  4. lukebaker.org » Persistent Persistent Searches said,

    January 17, 2006 @ 4:32 pm

    [...] FWIW, I hope to eventually add a few more unrelated features to Gmail via this script. For an overview of how my modifications work see my post on Cookies and Contacts. [...]

  5. Zack Tennant said,

    February 8, 2007 @ 8:26 pm

    Mihai has updated his persistent searches script with some neat improvements. Any chance you could re-mod his with your contact/cookie storage? I love both yours and his, and wish I could combine them.

RSS feed for comments on this post · TrackBack URI

Leave a Comment