Stop native web application after reboot when opening on iOS

I am trying to create a "native web application" using HTML + JS on iOS. As you can know, you can add such an application to the desktop, and it will more or less look the same as a regular native application.

However, if I exit such an application and open it again, it reloads the entire page. This also happens when switching to such an application from another through the multitasking panel.

Is this the expected behavior or is there a way to stop this device from working?

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

+28
ios web-applications iphone-standalone-web-app
Nov 27 '10 at 13:05
source share
4 answers

You can save the state of your application in localStorage. When rebooting, check if the state is running, and then restore the application to where it was last.

+9
Dec 15 '10 at 19:39
source share

Same problem. In any case, if you do not want to reinvent the wheel, you can use a tool such as PhoneGap (http://www.phonegap.com/). Built-in web application shell with built-in access to several built-in functions. In addition, you save the application locally (quickly, safely), and you can, of course, charge it;) It is licensed under BSD or MIT.

+2
Jul 08 2018-11-11T00:
source share

You might want to see how to use the cache manifest so that it does not upload files.

Matt Moyt has a good entry here:

http://matt.might.net/articles/how-to-native-iphone-ipad-apps-in-javascript/

Basically you change the html tag to this

<html manifest="cache.manifest"> 

and write the cache.manifest file on the server, which indicates which files should be stored in the device’s cache and which should be rebooted dynamically from the network.

 CACHE MANIFEST local1.file local2.file NETWORK: network1.php network2.cgi 

You also need to make sure your web server is serving .manifest files with MIME text / manifest, otherwise this will not work. If you are using apache, put the following in your .htaccess file:

 AddType text/cache-manifest .manifest 
0
Jul 15 '11 at 3:23
source share



Refresh . Although my answer is closing, I think this is the easiest way to handle iOS forced reboots. My strategy does not stop the web application from reloading upon opening, but it gives you an easy way to keep the session active so that you can detect and restore the session from the server side so that the application flow is not (at the request of the OP).

NB; this works easiest if the pages of your web application are always accessed by the same URL (for example, http://webapp.yourdomain.com/index.php ); if not, you will need to save the user’s location in the server-side session data and redirect the user there when he enters your web application through the main URL.

As already mentioned, this allows you to save the state unscathed even between rebooting the device, therefore, even though the technical support of the web application does not restart when starting from the main screen, it seems to me that this is the easiest way to restore the state for the user without it replacing the reboot.




A less straightforward solution than using local storage is to extend the session cookie lifetime. This works through web applications (if they point to the same page, of course) and even between the web application and the regular web version of your application.

The trick is this:

 // Start or resume session session_start(); // Extend cookie life time by an amount of your liking $cookieLifetime = 365 * 24 * 60 * 60; // A year in seconds setcookie(session_name(),session_id(),time()+$cookieLifetime); 

For a more detailed discussion of this strategy, you can take a look at my answer to this question:

Maintain PHP session in web application on iPhone

0
Jan 30 '13 at 9:57
source share



All Articles