Major problem with Dojo Offline and Google Gears

I’m using Dojo Offline Storage, which is very cool. However, I’ve hit a snag.

I don’t know if it’s just started happening or if it has always done so, but it’s now storing against the full URL. So a variable stored to xyz.html is not accessible to abc.html, even though it’s on the same server!

Worse, changes in the querystring affect it too. So abc.html has a different storage set to abc.html?123.

Does anyone know how to solve this problem? I can’t see any reference to it in the Gears nor the Dojo docs.

Some script to test with. Save it to test.html. On the first hit, it says null. On the second it is happy. Load test.html?123 and it is null again. Why?

<script src="/static/js/dojo/dojo.js" type="text/javascript"></script>
<script src="/static/js/dojox/off/offline.js" type="text/javascript"></script>
<script type="text/javascript">
document.write(dojox.storage.get('kpk'));
dojox.storage.put('kpk', 'happy');
</script>

Heeelp! :)

This entry was posted in General and tagged . Bookmark the permalink.
  • http://kenneth.kufluk.com/ Kenneth

    There’s an example editor here, which would be cool to test with.

    http://codinginparadise.org/projects/dojo_offline/latest/offline-sdk/dojox/off/demos/editor/editor.html

    Except it doesn’t work, because the url is too long! :)

  • http://kenneth.kufluk.com Kenneth

    There’s an example editor here, which would be cool to test with.

    http://codinginparadise.org/projects/dojo_offline/latest/offline-sdk/dojox/off/demos/editor/editor.html

    Except it doesn’t work, because the url is too long! :)

  • http://kenneth.kufluk.com/ Kenneth

    Progress!

    It is dojo storage at fault, which stores keys in a database store based on location.href.
    I have hacked this into location.host for my needs, which means variables are shared across the whole domain. Wonderful.
    I now need to see if there’s a “legal” way to hack this into Dojo, which involves searching the code.

    If I’m honest, I don’t like this in Dojo, and I think it should be changed to work in a similar way to cookies.

  • http://kenneth.kufluk.com Kenneth

    Progress!

    It is dojo storage at fault, which stores keys in a database store based on location.href.
    I have hacked this into location.host for my needs, which means variables are shared across the whole domain. Wonderful.
    I now need to see if there’s a “legal” way to hack this into Dojo, which involves searching the code.

    If I’m honest, I don’t like this in Dojo, and I think it should be changed to work in a similar way to cookies.

  • http://higginsforpresident.net/ Peter Higgins

    File a ticket! Brad (Gears master, and Dojo committer) maintains all that stuff, and is very open the enhancements / changes usually. Just a matter of asking/participating.

  • http://higginsforpresident.net Peter Higgins

    File a ticket! Brad (Gears master, and Dojo committer) maintains all that stuff, and is very open the enhancements / changes usually. Just a matter of asking/participating.

  • http://kenneth.kufluk.com/ Kenneth

    I tried to register yesterday on dojo-toolkit, but haven’t got a verification email yet.

  • http://kenneth.kufluk.com Kenneth

    I tried to register yesterday on dojo-toolkit, but haven’t got a verification email yet.

  • Dan

    Kenneth-

    Could you email me? Im interested in buying your tinychat domain (if you are willing to sell it) If so, send me a msg to the email I made this post with (or reply back telling me to piss off :) )

  • Dan

    Kenneth-

    Could you email me? Im interested in buying your tinychat domain (if you are willing to sell it) If so, send me a msg to the email I made this post with (or reply back telling me to piss off :) )