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.
Related
I created a progressive web app and am using electron for app distribution to use some native features.
The PWA app works fine offline in Google Chrome.
The PWA updates work fine in the electron app but starting app offline fails to load anything. Using the inspector, the service workers are running.
No errors in the console and page is blank.
Is there a trick I am missing ?
PS: when loading page online, the network tab shows that all assets except the index page are served by the service worker. Oh, and on Google chrome, there is a (disk cache) for index page. This might be it.
After more testing I realised that this was an issue with my webpack configuration.
I use WorkboxPlugin to build the manifest and it was placed before HtmlWebpackPlugin and needs to come last. This was why the index page was not working: it was not in the manifest.
We've just been developing an update for our iOS application where we need to open up a web view and display a web page hosted on a 3rd party site. This has worked locally when building directly to a device using xCode, the application works as expected; the web page loads and we can interact with it as expected. However, if we build the application and deploy to test flight, on the same device the webview functionality no longer works. Everything else works as expected but when the webview opens it just stays blank - the web page doesn't load/display. It's the same device, the same code base and same 3rd party link, so the only difference is the provisioning profile we're using (dev vs ad-hoc). Looking in application services I can't see any thing that looks like we should be setting (in fact our dev/ad-hoc provisioning profiles have the same settings). We are looking to see if there is any event we can hook into to get more detail but the application isn't crashing. Has anyone come across something similar before or point us in a direction/area that could help throw more light on the problem (might be searching for the wrong thing, but not found anything on google / stackoverflow).
In the end this appears to be down to a difference in the execution of the code when built and when deployed (maybe deployed is faster). We traced that all the relevant calls were being made using Charles proxy and looking in somme logging we had running on the web server. To try and find out where the code was getting to we added "alert boxes" - with these in place both versions displayed the web page correctly (locally built and deployed through test flight). As we couldn't leave the alert boxes in :) the solution was to move where we set up the web call and also to programmatically create the web view, rather than using one attached to the XIB. Still haven't got to the bottom of what exactly was happening.
I have a web application based on sencha touch 2 framework.
simply when adding home screen shortcut in iPad and open the application each time application restart from beginning and iPad didn't save the state of current page.
The Cache size of my application about 2MB.
Can I save state of my application like Safari ?
To go offline you should configure app cache manifest and specify the resources that are available online or offline.
Read the following
http://www.sencha.com/learn/taking-sencha-touch-apps-offline/
http://www.w3schools.com/html5/att_html_manifest.asp
Try configuring routes for your controller action. That way the state is persisted through the url when you switch back.
Try to wrap the web application to the native one using cordova (formerly phonegap) package.
I'm having a very strange issue with my web app (which is ran in full-screen mode from the home screen) and Mobile Safari. Usually, as I develop, I edit the files with the changes that I want to make and then I re-launch the app from the homescreen. As per iOS design, the web app will refresh and reload the site.
However, in some odd but frequent situations, when I launch the application I get a cached older version of the app. If I navigate to the app through Mobile Safari (not from home screen) then everything looks great.
I've added meta no cache tags all over the space and even attempted to thwart the cache by adding ?query strings to .css files, etc, but for some odd reason when a cached version decides it wants to display - it will display, no matter what. Clearing cache and data from the settings menu and then relaunching will only sometimes fix the problem.
Anyone else run into this issue? If so, how did you fix it? Is it a known iOS bug? I'm thinking about adding some onLoad code to check if the application is running in full screen mode and then explicitly force a refresh.
Please help - this is extremely annoying and frustrating!
Rich
In my own testing I also found that applications run from the "Home Screen" on iOS won't properly refresh their CSS and JS files. This appears to be an ongoing problem. The only solution that worked for me was to:
Change the device date forward by 2 days or so..
Reload the app from the Home Screen..
Reset the date.
I also tried deleting and recreating the icon from the home screen and clearing the cache in Safari.
"Happily" you are not the only one seeing this problem.
https://discussions.apple.com/thread/3385843?start=90&tstart=0
Incase anyone asks. There were no manifest files involved in my testing.
iPad 2 with IOS 5.1.1.
Enable Debug console from "Settings>Safari>advance" and see if you've any errors there.
Most probably you may have an 'Invalid MIME type", Manifest Parsing or Resource Fetch Failure Error.
Fix them (this link might help in fixing those http://www.fuckyeahtml5.com/2011/06/debugging-html5s-offline-web-apps/).
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?