I'm working on a site that uses a Google Custom Search. The search box is set with a background image (a watermark reading "Google(tm) Custom Search"). When the box has focus, its background is white, otherwise it's the watermark if there is no text in the box. So far so good.
Now, in IE, there appears the annoying bug that if you enter a query in the box, go to the search page, and then hit Back, both the watermark and the search text is in the box (until you give it focus). In my testing, it appears that, when the Javascript tests whether the box is empty or not, the field is empty, but is populated with the cached field value afterwards, which means that the watermark is added and THEN the text is filled. I've tried adding the function that tests the field value as an body onload event handler, to the same result. Strangely, I've even tried setting the value to be empty, and IE seems to overwrite the set value when it populates from the cache.
This could probably be fixed by sending no-cache headers, but I don't want to completely disable caching for all pages. Does anyone know more about this issue? Is there some event I could observe that would occur after the field is filled from cache?
tl;dr when does IE populate fields from cache?