Reputation: 33
Is there a way I can prevent browser image caching in an HTML email without using Javascript? I have an HTML email with an image that I want to be reloaded every time the email is opened in Gmail webmail. Right now it seems the browser is caching the image.
Upvotes: 2
Views: 4470
Reputation: 29
Unfortunately, since 2013 Gmail started adding images to its native web interface and mobile apps cache, but external apps and services retrieving mail from Gmail will download the normal images.
This snippet placed in the embedded CSS area can fix this issue by disabling the cache:
header('Content-Type: image/jpeg');
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
Upvotes: 2