iPad 主屏幕应用程序每次打开时都会刷新
我正在使用 HTML5 和 SenchaTouch 为 iPad 编写一个 Web 应用程序。该应用程序使用缓存清单来离线运行。一旦将其添加到主屏幕并在没有 Safari 的情况下打开,每次打开时它都会自行刷新,即使只是导航到主屏幕并返回。理想的行为是离开应用程序,执行其他操作,然后返回应用程序,一切保持不变。
可以在此处找到显示相同(不需要的)行为的类似应用程序的示例:http://ignitedmediadesign .com/WebApp/index.html
我读到,使用缓存清单应该可以解决 iPhone 上的这个问题( http://www .stevesouders.com/blog/2011/06/28/lack-of-caching-for-iphone-home-screen-apps/ ),但似乎没有完成适用于 iPhone 或 iPad 的技巧。
还有其他方法可以解决这个问题吗?是否有一些缓存清单文件的秘密可以阻止我可能错过的情况?
I'm writing a web app for the iPad using HTML5 and SenchaTouch. The app uses cache manifest to function offline. Once it has been added in the home screen and opened without Safari, it will refresh itself every time it is opened, even if just navigating to the home screen and back. The desired behavior is to leave the app, do something else, and then come back to the app with everything untouched.
An example of a similar app that displays the same (undesired) behavior can be found here: http://ignitedmediadesign.com/WebApp/index.html
I've read that using a cache manifest should have solved this problem on iPhone ( http://www.stevesouders.com/blog/2011/06/28/lack-of-caching-for-iphone-home-screen-apps/ ), but doesn't seem to have done the trick for either iPhone or iPad.
Is there another way to fix this? Is there some secret to cache manifest files that stops this that I may have missed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的印象是,这只是在正常 Safari 之外运行的“主屏幕”网络应用程序的本质。我有一个应用程序在 Safari 中运行得很好,只有一些最小的状态保存,但该死的非 Safari 版本每次都会刷新。编辑:即使是展示的使用缓存清单的 O'Reilly 示例,每次添加到主屏幕时也会重新加载。
您可能需要考虑创建指向控制器/操作对的“路由”(URL 片段)。查看 MVC PhoneGap 示例(如果没有使用 PhoneGap,您可以滚动浏览所有这些内容并实现您自己的数据模型和存储)。另请参阅此 Sencha Touch MVC 教程。
此外,大多数渲染的 sencha 触摸组件似乎在活动项目的更改之间保持状态。例如。我有一个包含所有子面板的主 TabPanel。当在主 TabPanel 的 TabBar 上的选项卡之间切换时,每个子面板都会保持其渲染,除非我设置了侦听器或控制器操作来执行其他操作。
希望这有帮助。
I'm under the impression this is simply the nature of the "home screen" web apps that operate outside of normal Safari. I have an app that operates just fine in Safari with some minimal state saving, but the blasted non-Safari version refreshes every time. EDIT: Even the showcased O’Reilly example that uses a cache manifest reloads every time when added to the home screen.
You may want to look into creating "routes" (URL fragments) that point to a controller/action pair. Look into the MVC PhoneGap example (If not using PhoneGap, you can scroll past all of that stuff and implement your own data model and store). Also see this Sencha Touch MVC tutorial.
Also, most of the rendered sencha touch components seem to maintain state between changes of the active item. For example. I have a main TabPanel that contains all sub panels. When switching between tabs on the main TabPanel's TabBar, each sub panel maintains its rendering, unless I've set a listener or controller action to do otherwise.
Hope this helps.