I am banging my head against the wall here. I have a gd-generated image that keeps being changed via ajax on my page. Since the image is generated based on querystring parameters (which don’t change) but is based on a model (that is constantly changing), the browser caches the image and you have to do a page refresh to update the image. I have hacked around it by appending a random number to the querystring, but that should make every image be cached to the browser, which I don’t want to do to my clients if I don’t have to (there will be LOTS of images). What I have found online is that I need to change the headers that I am sending out. Here’s what I have and it doesn’t work. I don’t know if the headers aren’t being sent or if I am sending the wrong headers or a sickly combination of the two…
headers[‘Cache-Control’] = ‘no-cache, must-revalidate, post-check=0, pre-check=0’ headers[‘Pragma’] = ‘public’ headers[‘Expires’] = “0” send_data image.jpeg, :type => “image/jpeg”, :disposition => “inline” #this line works
Any help would be greatly appreciated.