HTML5历史记录API - 状态对象的最大大小是多少? [英] HTML5 History API - What is the max size the state object can be?

查看:154
本文介绍了HTML5历史记录API - 状态对象的最大大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pushState 方法接受状态对象。 Firefox文档称该对象的最大大小为640kb。是否在规范中定义了浏览器可以实现的最小最大大小?我可以合理地期望主流浏览器为我提供至少100kb的数据吗?

The pushState method accepts a state object. Firefox documents say the maximum size of this object is 640kb. Is it defined in the specs what the smallest maximum size a browser can implement is? Can I reasonably expect major browsers to provide me with at least 100kb?

编辑:我用Chrome测试了它,它仍然适用于超过1MB的状态对象。

I tested it out with Chrome, and it was still working for state objects over 1MB.

推荐答案

不。这里的规范性文件是 http://www.whatwg .org / specs / web-apps / current-work / multipage / history.html#dom-history-pushstate ,它甚至没有提到数据大小的限制。但是建议使用不同的限制:

No. The normative document here is http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#dom-history-pushstate and it doesn't even mention a limit for the data size. A different limit is suggested however:


用户代理可能会限制添加到会话的
状态对象的数量
每页历史记录。

User agents may limit the number of state objects added to the session history per page.

正如您在此示例中所看到的,规范通常避免提及任何硬限制,并由浏览器自行决定制造商。因此,即使在未来的某个时候对规范进行修订以考虑数据大小限制的可能性,也不太可能给出实数。相反,它将足够大,适用于常见用例。

As you can see on this example the specification generally avoids mentioning any hard limits and leaves them at the discretion of browser makers. So even if the spec is revised at some point in future to consider the possibility of data size limits, it is unlikely to give you a real number. Instead it will be "big enough for common use cases".

这篇关于HTML5历史记录API - 状态对象的最大大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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