Offline iOS7 web app: doesn't update manifest - ipad

I have written a web app for offline usage on iOS7 safari and, while it does download the files in the manifest for offline usage, it never updates cached files when the manifest changes.
I have a php script that loops through files in a directory and creates a cache.appcache file. It also adds a comment that is a md5 of the files so that each time a file changes, the cache.appcache file will update.
This works fine on desktop chrome and the app cache update is triggered. However, on the iPad it never tries to update the cache: I have to clear the device's cache manually to get the updated app.
Is there something I'm missing?

http://html5doctor.com/go-offline-with-application-cache/#trigger-refresh
Updates in the cache.manifest file are supposed to trigger cache updates. This was happening on desktop browsers but not on the iPad.
For future reference this appeared to be caused by a combination of iOS 'web app' mode and the HTTP Auth password I had on the page. It seems that this combination prevented the cache update check because it worked fine in regular iOS safari but only worked in both after I removed the password.

Related

HTML5 web app not caching when added to home screen on iOS

I have web application ASP/MVC which uses application cache and it has to work as standalone application when added to home screen. It works fine, but on iOS10 it doesn't cache and doesn't work on offline mode. I don't have exact steps but it seems like it stops workign when i add this application for second/third time:
1 I add application to home screen and it works properly
2 I add this application to home screen again - it doesn't work
And all next installed applications doesn't work.
Also i wasn't able to reproduce it on one of the test servers.
I would try to clen cache (maybe it would help) but because of atandalone applications are opened not in Safary on iPhone - i don't know how to do this.
Also i found script to debug application cache
https://jonathanstark.com/blog/debugging-html-5-offline-application-cache?filename=2009/09/27/debugging-html-5-offline-application-cache/
But when i run application which doesn't work in offline mode - it simply doesn't enter in any of events handlers.
Found out what the problem was. There was redirecting on another page on my site and you could redirect even if application cache is still loading content so the caching stops and after redirecting back we on purpose setted manifest to empty string (it turned out like a feature that after redirecting back caching doesn't start being loaded). But on another OS caching started loading according to previous manifest, and only for iOS 10 if manifest turns out to empty string - caching doesn't start.

Cordova/Phonegap ios CORS perpetually loading

I'm using xcode with an angular/ionic framework hybrid app for cordova. On my windows machine, I've been able to build and run for blackberry and android with this code successfully so I'm not sure what's not right. The back end is a Microsoft Web API restful service with basic windows authentication from active directory sending back JSON serialized data.
The main data call boils down to:
$http.get('http://192.168.0.12/api/values/1').
success(onSuccuess).
error(onFailure);
I'm sure I have the usual in the config and NSAllowsArbitraryLoads on the info.plist. I also have the most permissible "Content-Security_policy" meta tag on the main index.html file.
I'm fairly sure none of these are the issue because the loads will immediately fail in the safari development simulator dialog. My issue is that the load simply never finishes. If I double click the resource name in the "Network" tab, safari will open and load the data appropriately.
Again, this fails in the osx simulator and on a device hooked to the network. But works fine on my physical blackberry (Z10 lol) and android simulator on my windows machine.

How to stop auto load on cordova meteor?

I am creating ios app using meteor and i have all the assets in the public folder, but still my app downloads assets from the server when it loads for the first time.
I am trying to stop auto reload or auto update on cordova.
I have tried this but didnt work.
if (Meteor.isCordova) {
Reload._onMigrate(function (retry) {
return [false];
});
}
I see two possibilities :
onMigrate
Use this on client side (/client folder)
Meteor._reload.onMigrate(function() {
return [false];
});
AUTOUPDATE_VERSION
$ AUTOUPDATE_VERSION=abc meteor
You can set the AUTOUPDATE_VERSION environment variable to something static, it will prevent autoupdate.
See Meteor Doc.
Edit note : mdg:reload-on-resume doesn't work on iOS. Issue #72.
Have you looked at the reload on resume package? Not on IOS at this time, sorry!
Add it to your Meteor app with meteor add mdg:reload-on-resume. This
package changes the behavior of Meteor's hot code push feature on
mobile devices only.
Normally, your app will update on the user's device as soon as you
push a new version. This process is always smooth in a desktop web
browser, but might momentarily interrupt the user's experience if they
are on a mobile device.
With this package, the app will only update itself to the newest
version if the user closes and re-opens the app (hence, it "reloads on
resume").
The Appcache package will stop your app downloading when it first loads
Once a user has visited a Meteor application for the first time and
the application has been cached, on subsequent visits the web page
loads faster because the browser can load the application out of the
cache without contacting the server first.

iOS Clears HTML5 Offline Cached Data

We developed an offline HTML5 web-app using the .manifest caching mechanism. Everything works as expectet.
Now some of our customers complain that after a long period of offline usage the cached data suddenly disappeared. It turns out - this is my guess - that iOS stores the cached files in its /CACHES/ directory, which, since iOS 5.0, can get purged if the device gets out of space. This can happen anytime, without even a warning to the user. Hence, the offline webapp is no longer running properly. The user has to reconnect the device to the internet and update the app.
For native Apps this problem is solved by storing the files in the /DOCUMENTS/ dir, using the flag 'do not backup' which prevents the files from being purged (since they don't sit in the /CACHES/ dir, and are not backed up to iCloud or iTunes.
See this link for details: http://www.marco.org/2011/10/13/ios5-caches-cleaning, however this does not say anything about HTML5 caching...
This one explains it again, however no solution: http://www.moneytoolkit.com/2012/04/apple-ios-html5-localstorage-is-broken/
Has anyone experienced the same? Is there a solution to this? The goal is to install a web-app once, and then run it without connection 'forever'...
Cheers, pawi
There is no way around this in Safari. A cache is never considered to be permanent.
If you have a UIWebView inside a native app, you can set WebKitStoreWebDataForBackup to YES in your user defaults. (iOS 6+ only)

iOS: Did Apple disable HTML5 offline capability for web apps saved to the home screen?

I've been doing lots of work in getting a few web apps to work offline on iOS using the HTML5 manifest. I've ran across the typical problems everyone else has and fixed them and everything seems to be working fine—except in the case where I save the web app to the desktop on my iPhone 4.
If I do this and then enable airplane mode, I get the following alert when trying to access the app via the home screen: "your-app-name could not be opened because its not connected to the internet." Accessing the app via Safari browser works fine while offline.
If anyone knows if this is an error on my part, or even the slim possibility of a work around, do tell.
Even downloading the new Financial Times web app (very well done with extensive localStorage support) results in an error when accessing it offline from the home screen.
Technical specs: Running iPhone 4 with iOS 4.3.3 (but also saw the issue in 4.3.2)
After reading the comments (especially Rowan's) I ran more tests and found the answer:
No, Apple did not disable HTML5 offline capability for web apps saved to the home screen, it works - for the most part. There is a bug that will make it not work. It doesn't seem to have anything to do with your manifest setup (unless perhaps it downloaded a bad manifest or incomplete manifest at one point.) We don't know how widespread it is but the fix is to clear your Mobile Safari Cache.
Here's the steps:
Close the web app (make sure its not sticking around in the background).
Cleared Mobile Safari cache: Settings > Safari > Clear Cache
Reopened the app (for caching).
Close the web app again (make sure its not sticking around in the background).
Enabled "Airplane Mode": Settings > Airplane Mode
Reopened the app.
It should now work offline. If it doesn't then its probably a separate manifest issue in your app. Looks like a weird bug with the browser cache - or perhaps the cache was completely full? Who knows, but that's the answer. Thanks guys.
iOS seems to be very sensitive to load issues when offline.
I was getting your "could not be opened" error when offline on a page I was working on. The problem turned out to be that the page created an iframe pointing to a site that didn't have an AppCache. Removing those iframes fixed the issue.
In my case, I handled it using window.navigator.standalone which tells you whether you're running in an iOS homescreen app. The code looked like this:
if (!navigator.standalone) insertFrames();
add this to your html:
https://web.archive.org/web/20170201180939/https://jonathanstark.com/blog/debugging-html-5-offline-application-cache?filename=2009/09/27/debugging-html-5-offline-application-cache/
I found it massively useful - even though I've created my manifest file and compared it to other people's manifests this JavaScript debugging script gave me the clue I would have never found otherwise. I apparently had syntax error in my manifest ... long story short I had to remove everything and add the paths to each file/image one by one. The end result was the same however it worked... how weird!!! does whitespace / comments affect the syntax of the file?

Resources