替代饼干 [英] Alternative to cookies

查看:147
本文介绍了替代饼干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立便携式HTML / Javscript原型,其意图被压缩了,并通过电子邮件/ SharePoint共享。这里的关键词是便携 - 没有服务器需要运行这些prorotypes - 刚启用浏览器的脚本。而且没有数据库。

I build portable HTML/Javscript prototypes, which are intended to be Zipped up and shared via email/sharepoint. The key word here is 'portable' - no server is required to run these prorotypes - just a javascript enabled browser. And there is no database.

一些原型的要求,坚持我的数据(只是为了炫耀潜在功能)。我这样做,现在通过使用Cookie。这似乎为火狐,Chrome等做工精细,但Internet Explorer中出现不同的方式工作。

Some of the prototypes require that I persist data (just to show off potential functionality). I do this currently by using cookies. This seems to work fine for Firefox, Chrome, etc, but Internet Explorer appears to work differently.

在4096字节从域中所有的cookies的最大容量是打在IE6和7(我没有测试过8还)饼干停止工作。一旦这个限制被击中,那么即使从cookie读取似乎停止发生,原型休息。

Once the maximum size of 4096 bytes for all cookies from a domain is hit in IE6 and 7 (I haven't tested 8 yet) the cookies stop working. Once this limit is hit, then even reading from the cookie appears to stop happening and the prototype breaks.

是否有任何其他的方式,我能坚持数据,而不必使用服务器和数据库?

Are there any other ways that I can persist data without having to use a server and a database?

任何意见将大大AP preciated。

Any ideas would be greatly appreciated.

推荐答案

(如果需要的话,甚至多重的)存储在一个隐藏字段中的数据。

store the data in a hidden field (or even multiple ones if needed).

总结您使用从cookiees读入类/函数在一个单独的文件中的code,然后你就可以很容易地交换文件出现场/样品实例 - 那样容易潜在的评论一颗颗线,并取消注释出。

Wrap the code that you use to read from the cookiees into a class/function in a separate file, and then you can easily swap the files out for live/sample instances--potentially as easily as commenting out one line, and un-commenting out the other.

修改DUE TO请求COMMENT
这将跨越多个页面的工作,只要你在多个页面推隐藏字段中的数据。如果你不希望从一个页面做的帖子下,那么你可以用网页(S)到一个框架,然后让隐藏域位于未显示的图像元素(在这种情况下,字段不技术上需要隐藏的)。

EDIT DUE TO REQUEST IN COMMENT: This will work across multiple pages, provided that you push the data in the Hidden Fields across the multiple pages. If you don't wish to do POSTS from one page to the next, then you can wrap the page(s) into a frame and then have the Hidden Fields be located in a frame element that is not displayed (in this scenario, the fields don't technically need to be hidden ones).

这是什么,是被访问的页面有一个帧标记,它指向两个不同的页面。第一页是应用程序本身,而这需要所有可见的房地产。第二页就是将举行一个或多个控件,将保留数据的页面,而这第二页是不可见的(用户)都没有。由于这些页面是一样的域的一部分,那么这是一件容易的事为框架孩子去跟它的兄弟姐妹之一,读/写数据到隐藏页面的各个领域。

What this is, is the page that is accessed has a FRAME tag, that points to two different pages. The first page is your application itself, and that takes up all the visible real estate. The second page is just a page which will hold one ore more controls that will retain the data, and this second page is not visible (to the user) at all. Since these pages are all part of the same "domain' then it's an easy matter for the frame child to talk to one of its siblings and read/write data to the hidden page's fields.

和,这得到周围的cookie限制的方式是,一个文本输入字段技术上仅由在计算机上的存储器和网络吞吐量的超时限制。例如,我见过有20MB值得它的数据隐藏字段之前(觉得最邪恶邪恶ViewStates的)。

And the way that this gets around the cookie limit is that a text entry field is technically only limited by the memory on the computer and the timeout of the network throughput. For example, I've seen a hidden field with 20MB worth of data in it before (think the evilest of evil ViewStates).

这篇关于替代饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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