Reputation: 31
We're building a Meteor app. One page of this app is a dashboard which shows all of your cliënts. All of these cliënts have images. The page is loaded perfectly but on refresh of the app the images aren't loaded from the browser cache but are loaded from the (external) image server again.
We want the images be loaded from browser cache.
The headers of an image are:
accept-ranges:bytes
cache-control:public
content-length:8613
content-type:image/jpeg
date:Fri, 17 Mar 2017 15:48:15 GMT
etag:W/"37533ce4359fd21:0"
expires:Sat, 18 Mar 2017 15:48:14 GMT
last-modified:Fri, 17 Mar 2017 15:48:15 GMT
server:Microsoft-IIS/10.0
status:200
x-powered-by:ASP.NET
On page refresh the image is still loaded from the server whilst js files are loaded from browser cache: overview of requests
Upvotes: 3
Views: 206
Reputation: 644
If your images are coming from external links (like FB avatars) they will not be cashed in that way: "The appcache package is only designed to cache static resources. As an "application" cache, it caches the resources needed by the application, including the HTML, CSS, Javascript and files published in the public/ directory." For this situation you can use Cloudinary. I use it in a mobile app and I think it does miracles.
Upvotes: 1
Reputation: 10705
You should be able to get your public resources (including images) to cache by using the appcache package. I don't believe this package is added to a new meteor project by default. You can read more about it here.
Upvotes: 0