作为本地应用程序运行的iPhone网络应用 [英] iPhone web apps running as native apps

查看:158
本文介绍了作为本地应用程序运行的iPhone网络应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iPhone上的浏览器能够使用HTML5中引入的高级网络技术。其中之一是应用程序缓存,它允许网页在缓存中运行在客户端上,而无需连接到互联网。与本地存储一起,您还可以将数据永久保存在页面中。



我的问题是,是否可以创建一个网站,以便在访问时将其设置为一个网络剪辑(主屏幕上的书签),可以随时再次访问。使用HTML5,Javascript和css,你可以制作一些非常好的应用程序,同时避免昂贵的开发人员费用,苛刻的应用程序批准和单一平台开发平台?

或者我只是在做梦?

解决方案

是的,你描述的肯定是可能的。您可以利用Apple对HTML5应用程序缓存的支持,方法是创建一个清单文件,指明要缓存的资源,并从Web应用程序的HTML页面中指定该文件。有关如何执行此操作的详细信息,请参阅 Apple的文档



更新:我已经在自己的网络应用程序上尝试了这个功能,并且它可以正常工作。您必须确保清单文件作为text / cache-manifest类型提供,就像它在文档中所述。另外,我不知道Safari会保证文件缓存多长时间。我发现手动清除Safari的缓存也会清除缓存的网页应用文件,即使是保存在设备主屏幕上的网页应用链接也是如此。


The browser on the iPhone is capable of using advanced web technologies introduced in HTML5. One of these is the app cache that allows web pages to run on the client, from the cache, without a connection to the internet. Together with Local Storage you can also save data permanently "in" the page.

My question is, would it then be possible to make a website that when visited and set as a web clip (bookmark on the home screen), could be accessed again, at any moment. Using HTML5, Javascript and css, you can make some very good apps and at the same time avoid the pricey developer fee, the harsh app approval and the single platform development platform?

Or am I just dreaming?

解决方案

Yes, what you describe is certainly possible. You can take advantage of Apple's support for the HTML5 app cache by creating a manifest file indicating which resources are to be cached, and specifying that file from within the HTML page of your web app. Details on how to do this are in Apple's documentation.

Update: I have tried this on my own web app, and it works. You have to make sure that the manifest file is served as type text/cache-manifest, like it says in the documentation. Also, I don't know how long Safari is guaranteed to keep the files cached. I have found that manually clearing Safari's cache will clear the cached web app files as well, even for a web app link saved on the device's home screen.

这篇关于作为本地应用程序运行的iPhone网络应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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