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
- Local storage
- Available in basically every browser that supports javascript
Cons
- Only supports strings
- XSS Issues
- window.name poisoning
- Information leaking to other sites
Alternatives
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…