Sunday, January 25th, 2009

jData: pseudo-globalStorage for browsers

Category: JavaScript

Elijah Grey has created an open source implementation of a psuedo-globalStorage[”] called jData that works in Firefox 3+, WebKit Nightlies, and IE8 beta 2. We asked him to tell us more:

globalStorage[”] was supposed to be a globally shared storage interface but was too insecure due to every host having write access. Read access is unrestricted and write access require either user confirmation or a previously accepted request for the host to be trusted so the localStorage can not be abused. I implemented by using postMessage and localStorage (or globalStorage[] in the case of Firefox) on a certain host to share it’s localStorage will all of the internet. The format for communication between client and host is JSON and has a standard format for sending and responding.

I have also made a reference interface library named JIL (jData Interface Library) that provides a simple way to use jData. I have created a standard for what items should be named so stuff like ‘openid’ is always the item being set to set a user’s OpenID address.
There are a few different types of requests that can be sent to jData, and they are explained and easy to understand in the API reference.

Here are some examples of how someone might use this:

website 1:

  1. function setOpenID(openidURI) {
  2.   JIL.get('openid', function(oi) {
  3.     if ( oi == null ) JIL.set('openid', openidURI);
  4.   }
  5. }
  6. ...
  7. <form ... onsubmit="setOpenID(openid.value);return false;">

website 2:


  1. JIL.get('openid', function(openid) {
  2.   if ( openid !== null ) autoLogOnWithOpenID(openid);
  3. })

NOTE: Obvious security issues within.

Posted by Dion Almaer at 9:04 pm

2.7 rating from 11 votes


Comments feed TrackBack URI

Could you remove the “(first . I don’t want to say it in this email because >3 links causes some spamfilters to flag the message as spam.” part? You can link “API reference” to if you want to. Thanks.

Comment by EliGrey — January 25, 2009

Sorry, I copy & pasted the wrong URL. I meant to say about linking “API Reference” to

Comment by EliGrey — January 25, 2009

Hi, i like it .. but i don t find a demo page… where is it?

Comment by nunziofiore — January 26, 2009


Comment by EliGrey — January 26, 2009

thank you very much… mit was linked :-O i m so blind…

Comment by nunziofiore — January 26, 2009

it doesn t run with chrome

Comment by nunziofiore — January 26, 2009

@nunziofiore the release builds of Google Chrome don’t support postMessage (they do support localStorage though).
You need to use a Google Chrome nightly build to try it on chrome.

Comment by EliGrey — January 26, 2009

great EliGrey… it runs like a ferrari ;)

I think i’ll use it in some of my web app…
Nunzio Fiore

Comment by nunziofiore — January 28, 2009

Leave a comment

You must be logged in to post a comment.