在iOS上打开时停止本机Web应用程序重新加载 [英] Stop native web app from reloading itself upon opening on iOS

查看:109
本文介绍了在iOS上打开时停止本机Web应用程序重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用iOS上的HTML + JS构建本机Web应用程序。您可能知道可以将这样的应用程序添加到主屏幕,它或多或少看起来就像普通的原生应用程序。

I'm trying to build a "native web app" using HTML + JS on iOS. As you may know you can add such an application to the homescreen and it will more or less look just like a normal native app.

但是如果我退出这样的应用程序并且再次重新打开它再次重新加载整个页面。当通过多任务栏从另一个应用程序切换到这样的应用程序时也会发生这种情况。

However if I quit such an app and reopen it again it reloads the whole page again. This also happens when switching to such an application from another over the multitasking bar.

这是预期的行为还是有办法阻止设备执行此操作?

Is this expected behaviour or is there a way to stop the device from doing this?

作为示例,您可以将jqTouch-Demos从此处添加到主屏幕并进行测试: http://jqtouch.com/preview/demos/main/

As an example you can add the jqTouch-Demos from here to your homescreen and test it: http://jqtouch.com/preview/demos/main/

推荐答案

您可以在localStorage中保存应用的状态。重新启动时,检查状态是否正在运行,然后将应用程序恢复到最后的状态。

You could save the state of your app in localStorage. On restart, check to see if the state is running, then restore the app to where it last was.

这篇关于在iOS上打开时停止本机Web应用程序重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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