使用window.name在Web浏览器本地数据缓存 [英] Using window.name as a local data cache in web browsers

查看:377
本文介绍了使用window.name在Web浏览器本地数据缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到有关cookies和其他相关客户端的存储选项,并阅读有关使用window.name作为排序的数据缓存:

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

<一个href=\"http://en.wikipedia.org/wiki/HTTP_cookie#window.name\">http://en.wikipedia.org/wiki/HTTP_cookie#window.name

虽然它肯定有东西,使得它不太理想 - 我不会粉饰它,它肯定是在这个词的最真正意义上的黑客 - 它看起来很有希望。我有一个需要有关JSON的10K存储为客户端缓存,现在我送下来的页面,当我读到这个看起来它实际上可能适合我的需要和减少交通事故。

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?

赞成


  • 本地存储

  • 可在基本上所有的浏览器支持JavaScript

缺点


  • 仅支持字符串

  • XSS问题

  • window.name中毒

  • 信息泄露给其他网站

替代

  • PersistJS - http://pablotron.org/?cid=1557
  • dojox.storage - http://docs.dojocampus.org/dojox/storage

推荐答案

有许多方法来存储本地数据,LSO的Flash,HTML 5本地存储,饼干。谷歌齿轮。
看看 PersistJS ,一个JS客户端库,这将只是做了。

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.

这个帖子在 Ajaxian的详解多一点一下吧。

This post in Ajaxian elaborates a little more about it.

这篇关于使用window.name在Web浏览器本地数据缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆