I am writing an Apache Cordova app (v7.0.1).
Let's imagine that in my index.html, I reference some large JS library big-boy.js (300kb).
The native WebView never caches this file, and loads it each time adding to latency. If it was a remote resource (eg http://ift.tt/2xJLC8w), I could set the response headers to instruct the 'browser' to cache this file and not load it again.
However because the file system is not really a server I control, the 'request' it makes to 'http://filemy_path/to/big-boy.js' doesn't have configurable response headers, and so it's never cached.
My question comes in 2 parts:
1) How do I either set these headers or something similar such that the file is not read from disk every time I reload the page? I'd love to be able to keep it cached, stored in memory.
2) Do I misunderstand the way that browser caching works? Does it save cached remote resources to the disk anyway, and so there would be no benefit to caching a file already being loaded from the disk?
Thank you!
Aucun commentaire:
Enregistrer un commentaire