Questions tagged [offline-caching]

Offline caching typically means storing locally the data obtained from a remote service to make it possible to browse the data even when there is no connection to the storage.

The details of the implementation depend on actual needs of the application; however, in any implementation there is a local cache of data obtained from the service, so some requests for the remote data may succeed in that cache. It depends on the application logic how the cache is updated, and whether and how the user may control that.

A good example of an application that uses offline caching is a desktop e-mail client. It downloads all new mail from the server to the user's computer during the sync session; the user may browse the mail and write the replies; the outgoing mail will be sent when the application perfoms the next sync.

714 questions
158
votes
7 answers

Can Retrofit with OKHttp use cache data when offline

I'm trying to use Retrofit & OKHttp to cache HTTP responses. I followed this gist and, ended up with this code: File httpCacheDirectory = new File(context.getCacheDir(), "responses"); HttpResponseCache httpResponseCache = null; try { …
osrl
  • 8,168
  • 8
  • 36
  • 57
75
votes
3 answers

Why use a service worker for caching when browser cache handles the caching?

I read that using a service worker for offline caching is similar to browser caching. If so, then why would you prefer a service worker for this caching? Browser caching will check if the file is modified or not and then serve from the cache, and…
bvakiti
  • 3,243
  • 4
  • 17
  • 26
55
votes
6 answers

How to properly invalidate an HTML5 Cache Manifest for online/offline web apps?

I'm currently using a Cache Manifest (as described here). This effectively makes the necessary resources to run the application available when the user is offline. Unfortunately, it works a little too well. After the cache manifest is loaded,…
Justin Searls
  • 4,789
  • 4
  • 45
  • 56
39
votes
1 answer

Offline mode for Android app using the Google Maps API

Is there a way to use the offline mode in Android apps using the Google Maps API? Any direction to a tutorial or source code would be a massive help. I've been searching for hours without any luck. I know Google has released a way of using maps…
PropK
  • 687
  • 2
  • 12
  • 24
32
votes
3 answers

Does Firebase allow an app to start in offline mode?

I'm thinking of using firebase to write a mobile app using PhoneGap and the HTML5 Application Cache. Lets suppose each user has a list of TODO items. If the app is started when the phone is offline, will it be able to load data from the previous…
eug
  • 1,118
  • 1
  • 16
  • 25
30
votes
3 answers

Why isn't express-js setting the Content-Type header?

I have the following: var express = require('express'), app = express.createServer(); app.get("/offline.manifest", function(req, res){ res.contentType("text/cache-manifest"); res.end("CACHE MANIFEST"); }); app.listen(8561); The network…
Kit Sunde
  • 35,972
  • 25
  • 125
  • 179
28
votes
4 answers

Removing HTML5 Offline AppCache

I have an HTML document with an associated appcache manifest. But now I want to get rid of offline application caching for a while. If I remove mention of the manifest from the tag, browsers that already have a cached version will continue…
Trott
  • 66,479
  • 23
  • 173
  • 212
28
votes
6 answers

How to force service worker to update?

I'm using sw-precache to generate my service work with Polymer CLI build process, so it's intended to update the hash of updated files to signal a need to update the cache. But my updated content is not being replaced in cache, so it's getting an…
Jp_
  • 5,973
  • 4
  • 25
  • 36
27
votes
3 answers

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…
Mauvis Ledford
  • 40,827
  • 17
  • 81
  • 86
26
votes
4 answers

What is the use of `self.Clients.claim()`

To register a service worker, I can call navigator.serviceWorker.register('/worker.js') Every time the page loads it checks for an updated version of worker.js. If an update is found, the new worker won't be used until all the page's tabs are…
BonsaiOak
  • 27,741
  • 7
  • 30
  • 54
26
votes
4 answers

Application Cache or Service Workers - which to use in 2016/Q2?

Quick question for discussion really, as I wanted to have input from different people. I am in the process of developing a web page app that must be available offline. Now to do this, as I understand it, you would go about using either the…
23
votes
3 answers

How to make offline maps(using leaflet OSM) , by caching?

I am trying to make offline maps through caching (IndexedDB) in browser. I understand the concept is that I download and store the tiles of map first when connected to internet. Then I have to load the tiles logically offline. However, I'm not able…
Abhi Ram A
  • 305
  • 2
  • 4
  • 10
22
votes
5 answers

How do I specify a wildcard in the HTML5 cache manifest to load all images in a directory?

I have a lot of images in a folder that are used in the application. When using the cache manifest it would be easier maintenance wise if I could specify a wild card to load all the images or files in a certain directory to be cached. E.g. CACHE…
zuallauz
  • 4,328
  • 11
  • 43
  • 54
21
votes
5 answers

An unknown error occurred when fetching the script (Service Worker)

When going offline, I get the following error by my service worker: (unknown) #3016 An unknown error occurred when fetching the script my service worker looks like this: var version = 'v1' this.addEventListener('install', function(event){ …
21
votes
5 answers

Got this error with retrofit2 & OkHttp3. Unable to resolve host "": No address associated with hostname

I am using the retrofit 2 and OkHttp3 to request data from server. I just added a offline cache code but It's not working as expected. I got the error "Unable to resolve host "<>": No address associated with hostname." This occurs when It's try to…
android_griezmann
  • 3,757
  • 4
  • 16
  • 43
1
2 3
47 48