Captcha Image Cache issue in IE
Posted on 2008-10-04
I have a contact form on one of my websites and use a CAPTCHA image for stopping robot spammers. It works great as long as someone types the matching code. However, when they submit the form and it doesn't match, my page presents them the form and is creating a new CAPTCHA string which is supposed to appear in the image. However, in IE, the image is cached in the browser (doesn't do this in FF) and it shows the visitor the same "old" CAPTCHA string because the file is named the same each time.
I could certainly create a variable file name so it loads fresh each time, but then I'd have the overhead scripting of deleting them after a day or so, and if someone was malicious, it would create dozens and dozens on my hard drive.
I prefer my CFC to keep using the same image name each time it creates a CAPTCHA image. However, I need to know how to force the browser to load the newest generated image my script creates.