Skip to content

Commit

Permalink
Fix status code not only for the file protocol but everytime when sta…
Browse files Browse the repository at this point in the history
…tus is equal zero.

This fixes an issue on Android stock browser that occurs for me in Ice Cream Sandwich (4.0) and Jelly Bean (4.1). In these browsers the status code was 0 when AngularJS was requesting templates and get them served out of Appcache (http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html).
  • Loading branch information
joergschiller committed Sep 12, 2012
1 parent 331cd5a commit 63b5e34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ng/httpBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
// URL_MATCH is defined in src/service/location.js
var protocol = (url.match(URL_MATCH) || ['', locationProtocol])[1];

// fix status code for file protocol (it's always 0)
status = (protocol == 'file') ? (response ? 200 : 404) : status;
// fix status code when it is 0, i.e. for file protocol and appcache (aka. offline web applications)
status = (status == 0) ? (response ? 200 : 404) : status;

// normalize IE bug (http://bugs.jquery.com/ticket/1450)
status = status == 1223 ? 204 : status;
Expand Down

0 comments on commit 63b5e34

Please sign in to comment.