Say we have a function that creates an image with createElement
and adds a src
attribute to some folder in the backend then appends it.
function create() {
const image = document.createElement('img')
image.setAttribute('src', 'pictures/picture1.jpg')
document.body.append(image)
}
Every time I call the function the browser makes another request, and checking the request headers it shows Cache-Control: no-cache
.
So, is it possible to enable caching for something like this ?