简体   繁体   English

iOS HTML5 FileSystem API替代

[英]iOS HTML5 FileSystem API alternative

I have an application built that utilizes the HTML5 FilesSystem API, but it only works for Chrome. 我有一个使用HTML5 FilesSystem API构建的应用程序,但仅适用于Chrome。

Does anyone know of an existing plugin or a technique for replicating this functionality in iOS? 有谁知道现有的插件或在iOS中复制此功能的技术?

The catch is that I am rendering "mini-sites" for offline use. 问题是我正在渲染“微型站点”以供离线使用。 So I would need to be able to: 因此,我需要能够:

  • Download the files for the micro-site 下载微型站点的文件
  • Store them locally 将它们存储在本地
  • Access them later. 以后再访问它们。 Right now, I'm using an iframe to render the page 现在,我正在使用iframe呈现页面

My solution (right now) is to do the following. 我的解决方案(现在)是执行以下操作。

  1. Because I am caching microsite files that I am pulling from a 3rd party, I set up a folder on a webserver and built out a PHP-based "caching" service that routinely compares the content I have stored on the 3rd part site to the same content stored locally to my server. 因为我正在缓存从第三方提取的微型网站文件,所以我在网络服务器上设置了一个文件夹,并构建了一个基于PHP的“缓存”服务,该服务通常将我在第三部分网站上存储的内容与同一内容进行比较内容存储在我的服务器本地。 It updates the content where necessary. 它在必要时更新内容。
  2. The app, when it is run from iOS, will asynchronously load each of the microsites in an iframe (create a frame of size 1 x 1px with the appropriate src). 从iOS运行时,该应用将在iframe中异步加载每个微型网站(使用适当的src创建大小为1 x 1px的框架)。 The iframe self-destructs after loading is completed. 加载完成后,iframe会自毁。
  3. Step 2 allows my service worker to cache all of the micro-sites locally, along with the main site. 第2步允许我的服务工作者在本地缓存所有微型站点以及主站点。
  4. I have other code in place to keep the local iOS cache "fresh". 我还有其他代码可以保持本地iOS缓存“新鲜”。

This works, but it is nowhere near as ideal as the Chrome File System API, so any alternative suggestions would be great! 这行得通,但远没有Chrome文件系统API理想,因此任何其他建议都很棒!

Thanks, Wayne 谢谢,韦恩

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM