Goyuix
Goyuix

Reputation: 24340

Using window.name as a local data cache in web browsers

I was reading about cookies and other related client-side storage options, and read about using window.name as a data cache of sorts:

http://en.wikipedia.org/wiki/HTTP_cookie#window.name

While it certainly has things that make it less desirable - and I won't sugar coat it, it is definitely a hack in the most true sense of that word - it looks promising. I have a need to store about 10K of JSON as a client cache, right now I am sending it down with the page and when I read about this it seems like it might actually fit my needs and reduce traffic.

I am curious to see if anyone has implemented this, and what advice you could possibly give. Pitfalls? Recommendations? Differences between browsers? Some sort of usage case that would be really bad?

Pros

Cons

Alternatives

Upvotes: 14

Views: 9970

Answers (2)

Sug
Sug

Reputation: 802

There are many ways to store local data, Flash LSO, HTML 5 Local Storage, cookies. Google gears. Have a look at PersistJS, a js client library that will just do it.

This post in Ajaxian elaborates a little more about it.

Upvotes: 5

Rob Van Dam
Rob Van Dam

Reputation: 7960

This seems to be first implemented here: http://www.thomasfrank.se/sessionvars.html.

However, if this technique takes off, I would bet money that the browsers would eventually crack down on it due to its inherit vulnerability to XSS.

A more long term solution is likely to be: http://en.wikipedia.org/wiki/DOM_storage which grew out of the HTML 5 specification (the biggest drawback being the lack of backwards compatibility for browsers before IE 8).

Upvotes: 2

Related Questions