This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
angularjs incorrectly returns status 0 on Android when fetching from the application cache #1720
Labels
Comments
You could fix both bugs in one line of code: // fix status code for file protocol (it's always 0) and 0 status code for http(s) protocol on Android devices
status = (protocol == 'file') ? (response ? 200 : 404) : (response && status == 0 && window.navigator.userAgent.indexOf('Android') !== -1 ? 200 : status); Also this code targets just Android for the "0" status code. |
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months. Please try the newest versions of Angular ( Thanks! |
Could anyone tell me what are the various status codes less that -1 (and their meanings) that are normalised to 0? |
I don't think they are standard, so it probably depends on the browser. Often they represent network failures or browser-quirks. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm building a mobile web application using AngularJS, and I'm encountering the following issue. My application is cached using an HTML5 Application cache. It loads fine, but if I manually kill the browser (or cause Android WebKit to unload the document), I encounter a problem in $httpBackend:
In the case of loading a file from the appcache (in this case, the template to a particular route for ng-view), status == 0. Because of this, $http rejects the promise instead of resolving it, and the view is never loaded.
I'm wondering if this line could be added after the file protocol check:
This solves the appcache problem correctly, but I'm not sure if that solution exposes another problem.
Thanks!
The text was updated successfully, but these errors were encountered: