Markus
unread,Jul 16, 2011, 9:38:48 AM7/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
Hi everyone,
got a quick question / call for some collective brain-storming:
I need to store a small bit of data locally on the client without
creating a dependency on flash, gears, ff3, etc.
The way that seems most natural to me is to use a cookie, but I run
into the following issues with this:
- Simply setting a cookie on the page itself is not a good idea as it
gets sent to the server with every XHR request.
- I added a subdirectory to my site ("localcookies") with a small
script that is loaded into an i-frame and provides a mechanism to set
and read a cookie in that subdirectory. This way, the cookie is sent
only once to the server, when the iframe is loaded.
- Now my hope for the next step was to tell the browser to cache this
script, so that it is not loaded again at all, but that doesn't seem
to work. I actually haven't figured out yet why it doesn't work. It
almost seems like FF doesn't cache pages that have a cookie set...
- Unfortunately, there does not seem to be a way to set or read the
cookie from a script outside the subdirectory either, probably to
prevent cross-site vulnerabilities.
So, what I'm trying to figure out is whether there is any way using
some trick with page caching, URL redirects, subdomains,
subdirectories, etc. to get the browser to not send a cookie to the
server, but still provide access to it from JS.
Or could there be a way to use a URL? Is there, for example, a cross-
browser way to update a bookmark to include the data in a hash tag? Or
could there be a way to use the "save username and password" feature,
or can you access the autocomplete suggestions for a text-box?
I looked at some other posts and most people come to the conclusion
that g-gears or something like this would be the right way to do this,
but I really would not like to create that extra dependency, so let's
not open that discussion here again as there are plenty of other
threads that already talk about this.
Thanks for your help and ideas,
Markus