HTML 5 的“离线 Web 应用程序”功能有哪些新功能尚未在所有浏览器中可用?
离线缓存是浏览器的工作——它是如何成为 HTML 的工作的?
A web cache is a mechanism for the temporary storage (caching) of web documents, such as HTML pages and images, to reduce bandwidth usage, server load, and perceived lag. A web cache stores copies of documents passing through it; subsequent requests may be satisfied from the cache if certain conditions are met.
如维基百科关于 Web cache 的文章所写.
这是为 W3C 网站中的离线网络缓存编写的:
In order to enable users to continue interacting with Web applications and documents even when their network connection is unavailable — for instance, because they are traveling outside of their ISP's coverage area — authors can provide a manifest which lists the files that are needed for the Web application to work offline and which causes the user's browser to keep a copy of the files for use offline.
HTML 5 在缓存方面做得更好和不同的是什么?
是不是类似于offline mode in Internet Explorer 5 ?我们是否可以缓存超出浏览器设置的空间量限制的数据?
请给我一个示例,以便我了解 HTML 5 离线缓存和浏览器缓存的区别。
最佳答案
Web 浏览器缓存是指浏览器决定在本地存储文件以提高性能。 HTTP 允许网络服务器建议浏览器将文件存储多长时间,并允许浏览器询问服务器文件是否已更改(这样他们就可以避免重新下载它)。
但是,它并非旨在可靠地存储离线应用程序所需的 Assets 。最终取决于浏览器是否缓存文件以及缓存多长时间。如果浏览器无法联系服务器检查它是否是最新的,它们通常会停止使用它们的缓存版本。
HTML5 离线网络应用程序规范为网络作者提供了告诉浏览器为离线访问存储什么的能力,并要求浏览器在在线时保持这些文件为最新。它还提供了一个 DOM 属性,告诉开发人员浏览器是在线还是离线,以及当在线状态改变时触发的事件。
As Peeter describes in his answer ,这允许网络应用程序开发人员在用户离线时存储用户输入的数据,然后在他们再次在线时将其与服务器同步。开发人员必须手动进行此存储和同步,因为浏览器仅提供指示在线状态的事件,但如果浏览器也支持 localStorage,则开发人员可以将数据存储在那里。
我只能为您指出深入 HTML5 的相关章节:http://diveintohtml5.ep.io/offline.html
关于html - HTML 5 "offline web application"中有哪些新内容尚未在所有浏览器中可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6371582/