avoid browser image caching in webmail gmail

4.1k views Asked by At

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.

1

There are 1 answers

2
Perry Clark On

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");