Unable to fetch iOS webapp files on manifest update. 401 unauthorized - html

I have a HTML5 webapp which is running perfectly when served via the IIS without authentication.
Is is using a cache.manifest file.
Both when running in safari, and as an "add to homescreen" fullscreen app, once I update the manifest file on the server, and the app will update.
When I turn on authentication on all files except the cache.manifest, then I only see the update when running it in the safari browser.
If I add it to the homescreen, I am not able to make the app update the cache.
If I wireshark the traffic on the server, I can see the manifest file is fetched without problems, but all the files in the manifest file hits a 401 Unautorized error.
Any idea how I can fix this? Running it in the safari browser is working..
Any help is highly appreciated.

Safari is much more aware of HTTP Basic Auth, but web.app (the home screen web app handler, which is basically a UIWebView wrapper) isn't as full-featured and doesn't appear to support basic auth.
It seems you may need to work around this with either a server-side solution to append an authentication key to the filename (such as application.css?longhexkey) to bypass basic auth, or go with a more traditional login form (which may require significant changes to your app)
Same issue on Sencha forums: Unanswered: Forcing re-authentication after offline usage on iOS devices?

Related

how html5 apache works first time

I have created one HTML5 web app which works in offline mode.I load it first time form server and then when server is off it works perfectly.Webapp url is http://localhost/index.html
Now , if I try to load that webapp first time on any new machine then how can it resolve the localhost url.I have all the resources bundled with webapp.
In this case server is off and browser is not able to locate url http://localhost/index.html
Any idea if webapp can work in offline mode , even if its not connected to server ever.
What you are doing and expecting seems to make sense. It would be smart to check the console in the Chrome Developer tools. Something along the lines of the following should be shown:
You might be serving the manifest file with the wrong content type (should be text/cache-manifest) or the fact that you're working on localhost might somehow interfere (dunno).

FireBug in Chrome doesn't show up on local websites

When I right-click on the local html page and select "Inspect with FireBug Lite" nothing happens... on regular online sites it works except for "https://chrome.google.com/webstore/category/apps"
anyone had the same experience? I have the latest version of the extension (but it's from 2011 :/)
UPDATE: on some local sites it does show! on two web apps (PHP, Rails) it did work, but on a few static HTML files I tried it didn't....
Apparently this is normal...:
It doesn't work on local pages
If by "local pages" you mean files accessed via "file:///" protocol then yes, Firebug Lite doesn't work with "file:///" protocol. This is a JavaScript security restriction to prevent malicious web pages from accessing files in your your machine. Also, please note that the while you can load a "local page" in the browser (it will render properly) it will NOT behave exactly the same as when hosted in a web server.
Solution:
You can solve this problem by loading your page in a web server installed in your machine, so you can access that local files through "http://" addresses. This is the best solution: it is safer, and you'll get the most of what Firebug Lite can give you. I recommend using Apache HTTP Server, but you can use anyone (like IIS for example).
Which exact URL are you visiting? It is an internal Chrome's page
(like "chrome://downloads/"), or some page related to Google Chrome
extensions "https://chrome.google.com/extensions/")?
Google Chrome won't allow content scripts (required by Firebug Lite)
running on such pages. The problem is that Chrome does not inform the
user and neither the extension about it. In other words, there is no way
to Firebug Lite know if the content script was loaded or not, and we
worked around this by sniffing the URL and detecting when you visit
URLs that begins with "chrome://" or "https://chrome.google.com/extensions/",
alerting users in such cases.
You've few options to fix the solution.
One is to use Mozilla Firefox.
Second, install a web server on your system. Try WAMP or XAMPP. Once installed, store all the web pages in the root folder of the web server you just created. Save all the web pages and html files in C:\xampp\htdocs. Navigate to the locally stored webpages using your web browser by going to “127.0.0.1/index.html” or “localhost/index.html”.
Now you can use Firebug-Lite for Google Chrome on local files.

Appcache manifest downloads all files but still unable to access offline unless they have been accessed online

I have successfully created an appcache manifest that is downloading all of the website content. I have checked this through chrome dev and it's all working.
The issue I am having now is that even although the entire website has been cached, I am unable to access the cached pages when offline, unless I had accessed them online.
I am using Apache and accessing the website via an iPad using safari browser.
I have an idea that this may be due to the server not allowing access to cached pages unless they had been accessed online as some kind of security measure.
Any ideas?
if your files are in PHP or ASP this will not work.
It need to be JavaScript or other files that can be run localy like Image, HTML.

Offline Web App, Application Cache, Ipad iOS6, and HTTPS, HTML5

I am writing a web application that is meant to me utilized "sometimes" offline using the iPad's home bookmarked feature of Safari . By "sometimes", I mean that the app should work if the iPad is offline and data has been cached. If the iPad is online and the cache manifest has changed, the app should update the contents of the cache. The web page is protected through https.
Currently, I can get my app to work correctly using Chrome, Firefox, and Safari. I have tested them all in windows 7 and windows XP. The app also works correctly in the iPad's "normal" way of using Safari, but when I run the bookmarked version of the app (created by specifying the special standalone apple metas and then bookmarking) it does the initial password prompt and correctly moves on to download all the data specified in the cache manifest file. The trouble is that any subsequent runs of the standalone app do not seem to have access to the manifest file and thus any later updates to the manifest file do not get reflected.
So my question is this: does HTML5 specific caching work on the iPad (ios6) with https on a stand alone (bookmarked) web app?
Application Caching on iPad will not cache website data or pages
I was having the same problem. This answer worked. Hope it does for you too!

Prevent application cache from being discarded after cache manifest returns 404

I've created a web app and placed it on our intranet web server. If an iPad loads the app while on the intranet network, the app works. If I turn on airplane mode, the app works in offline mode.
However, I believe (and I don't have a debugger to test), if the iPad then connects to the internet, the app tries to access the cache manifest as it sees it is connected to a network, but the manifest request returns a 404 as it isn't on the intranet. The appcache is then discarded and the application stops functioning.
If what I'm saying is correct, is there some way to mitigate the appcache from being discarded when the manifest returns a 404?
Thanks,
Chris
I am, fortunately, completely incorrect. You can indeed move from different network environments and the app will continue to function.
My issue was that my web framework will publish the minified version of some javascript files in Production mode, which I didn't include in my cache manifest.
What threw me is that Chrome would throw an error when it can't reach the manifest, which is apparently entirely expected in this case. Given that much of the material on the web points to the appcache being discarded if an error occurs during the cache loading process, I had thought this was what was happening. Forutnately, this particular error doesn't impact offline mode.