Html 缓存清单大小限制和 Web 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6757945/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 09:38:45  来源:igfitidea点击:

Cache Manifest Size Limit and Web Apps

htmlweb-applicationsofflineapps

提问by VolatileStorm

I am in the planning phases for writing an application, still choosing the technology that I wish to use to write the app. The initial idea was to write a web-app but this has (had?) the downfall of being unable to be viewed offline. I then discovered cache manifest, and this potentially seemed like an answer.

我正处于编写应用程序的规划阶段,仍在选择我希望用于编写应用程序的技术。最初的想法是编写一个网络应用程序,但这有(有?)无法离线查看的缺点。然后我发现了缓存清单,这似乎是一个答案。

However, since that first point it seems that there are size limits on Cache Manifest. I can't find a full list of the size limits for each browser, so I can't tell if it's completely debilitating (though I think it may be). The browsers that I wish the app to work on are Firefox, Chrome and the mobile Safari browsers (that is, it has to work on iPad).

然而,从第一点开始,缓存清单似乎有大小限制。我找不到每个浏览器的大小限制的完整列表,所以我无法判断它是否完全削弱了(尽管我认为它可能是)。我希望应用程序运行的浏览器是 Firefox、Chrome 和移动 Safari 浏览器(也就是说,它必须在 iPad 上运行)。

My understanding is that in most cases there is a total cache limit of about 5MB (with it varying from browser to browser), but this would not be enough for my needs. I'm looking to store all of the users online data offline. This includes things like uploaded files (PDFs, pictures) as well as the content required to make the app physically work. In any example I've seen, cache-manifest has only been used to cache offline things like the html, the css, the javascript and the image resources of the website. Is it suitable for offline storage of PDFs the user has uploaded?

我的理解是,在大多数情况下,总缓存限制约为 5MB(因浏览器而异),但这不足以满足我的需求。我希望离线存储所有用户的在线数据。这包括上传文件(PDF、图片)以及使应用程序实际运行所需的内容。在我见过的任何示例中,缓存清单仅用于缓存离线内容,例如 html、css、javascript 和网站的图像资源。是否适合离线存储用户上传的PDF?

If the answer to this question is a resounding no (which I fear that it may be), are there any other solutions? Or is a "proper" app in a browser - that is, one with a reasonable space requirement - completely infeasible at this time? Are we still waiting for the browsers to catch up with the requirements of development?

如果这个问题的答案是否定的(我担心可能是),还有其他解决方案吗?或者浏览器中的“适当”应用程序(即具有合理空间要求的应用程序)此时完全不可行?我们是否还在等待浏览器跟上发展的需求?

Edit: Just to add, I am aware that there is no limit on Cache-Manifest in the HTML5 specification, but the implementations all seem to limit it, and this will affect anything I attempt to write.

编辑:补充一下,我知道 HTML5 规范中对 Cache-Manifest 没有限制,但是实现似乎都限制了它,这会影响我尝试编写的任何内容。

采纳答案by KimKha

You can see more about limit capacity here: http://grinninggecko.com/developing-cross-platform-html5-offline-app-1/

您可以在此处查看有关限制容量的更多信息:http: //grinninggecko.com/developing-cross-platform-html5-offline-app-1/

回答by Richard Herries

In case people are still wondering about this...

如果人们仍然想知道这个......

I've currently got an app that is 44MB of resources successfully downloaded and tested offline on Safari(6.1), Chrome(31), Firefox(26), iPad (ios7) and iPhone (ios6).

我目前有一个 44MB 资源的应用程序,在 Safari(6.1)、Chrome(31)、Firefox(26)、iPad (ios7) 和 iPhone (ios6) 上成功下载并离线测试。

Only problem I have discovered is when you add the app to the home screen. I've decided this is because the app is too big and needs to expand the cache however there is no handling for this and it just ends with an error. Work around -> reload the app. Close, open, and resave cache = works.

我发现的唯一问题是当您将应用程序添加到主屏幕时。我决定这是因为应用程序太大并且需要扩展缓存但是没有对此进行处理并且它只是以错误结束。解决 -> 重新加载应用程序。关闭、打开和重新保存缓存 = 有效。

回答by Srini

Appcache size is limited to 5 MB in android devices. If you are creating hybrid application for android devices, you need to ensure that appcache should not exceeds 5MB. Otherwise, appcache download is getting failed once it reaches size limit.

android 设备中的 Appcache 大小限制为 5 MB。如果您正在为 android 设备创建混合应用程序,您需要确保 appcache 不应超过 5MB。否则,一旦达到大小限制,appcache 下载就会失败。

The same issue wont occur in other devices (iphone, windows, blackberry etc).

其他设备(iphone、windows、黑莓等)不会出现同样的问题。

回答by Behnam Mohammadi

Mobile

移动的

| Chrome | Android Browser | Firefox | Safari | Safari | iOS WebView | iOS WebView |
|   40   |       4.3       |   34    |   6,7  |   8    |     6,7     |      8      |
|    ~   |        ∞        |    ∞    |  300MB | 300MB  |    100MB    |    100MB    |

Desktop

桌面

| Chrome | Firefox |   Safari   |   Safari  |   IE   |   IE   |
|   40   |    34   |     6,7    |     8     |    9   |  10,11 |
|    ~   |  500MB  |      ∞     |     ∞     |    ?   |  100MB |

Reference Link

参考链接

回答by Gaurav

There is no limit according to the spec, but I believe the limit is more than 5 MB. See also Is there a size limit for HTML5 Manifest?

根据规范没有限制,但我相信限制超过 5 MB。另请参阅HTML5 清单是否有大小限制?