清单文件下载大小限制(manifest file download size limit)

编程入门 行业动态 更新时间:2024-10-27 00:25:01
清单文件下载大小限制(manifest file download size limit)

我正在学习使用Manifest文件并有这个问题。 如果某个网站创建了一个清单文件,可以让我缓存3MB的文件,该怎么办? 当我在3G上运行时,3MB对我的iPhone来说很重要。 那么一些恶性网站可以创建这样的清单文件,让我用尽所有数据限额?

另一个问题是,作为一个负责任的开发人员,无论如何都要检测用户是否使用3G,以便我可以在前一种情况下提供较小的清单文件?

谢谢

I am learning to use Manifest files and had this question. What if some website created a manifest file that will make me cache files for, say, 3MB. 3MB is a lot for my IPhone when I run on 3G. So some vicious website can create such manifest file and make me use up all my data allowance?

Another question is that, as a responsible developer, is there anyway to detect if a user is using 3G or not so I can serve a smaller manifest file in the former case?

Thank you

最满意答案

您的问题标记为“iPhone”,因此我将提供针对iOS的答案。

保存链接到清单中的文件的脱机存储似乎限制为5MB。 这方面的证据都是间接的,因为Apple文档中没有提到限制。 但是,一些Apple工程师承认存在限制 。 在某些情况下,最新版本的Mobile Safari允许用户扩展存储,但作为开发人员,您不能强迫他们这样做。

5MB并不是那么多,许多用户肯定会注意到某些事情正在发生,如果他们不想让它发生,只需关闭标签即可。 据我所知,并非每个国家/地区都有相同的限制,但美国的大多数用户限制为2GB /月。 按照这个速度,一个毫无戒心的用户将不得不意外地重新下载你的清单,它列出的文件100次,只占其带宽分配的25%。 这是一个相当低的限制,恶意使用某人的数据分配的可能性是相当遥远的。

至于如何判断用户是使用3G还是WiFi,请查看Apple开发人员中心的可访问性示例。 它确实如此。 在我知道的网络应用程序(而不是本机应用程序)中无法做到这一点。

Your question is tagged 'iPhone' so I am going to give an iOS-specific answer.

The offline storage, which holds the files linked to in your manifest, seems to be limited to 5MB. Evidence for this is all circumstantial, as the limit is not mentioned in Apple docs. However, some Apple engineers have conceded that there is a limit. The newest versions of Mobile Safari, in some circumstances, offer to allow the user to expand the storage, but you, as a developer, cannot force them to do so.

5MB is not really that much, and many users will certainly notice that something is going on, and if they don't want it to happen, simply close the tab. I understand that not every country has the same limits, but most users in the US are limited to 2GB/month. At this rate, an unsuspecting user would have to accidentally re-download your manifest, and the files it lists 100 times to use up just 25% of their bandwidth allotment. It's a fairly low limit, and the possibility of maliciously using up someone's data allotment is fairly remote.

As far as how to tell if a user is on 3G or WiFi, check out the Reachability example in the Apple Developer Center. It does exactly that. There is no way to do it in a web app (as opposed to a native app) that I am aware of.

更多推荐

本文发布于:2023-07-26 08:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1272917.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:清单   大小   文件   manifest   limit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!