I had wrongly assumed that the Apache expiration module would give them a short expiration time by default. No problem, I added the expiration specification to my .htaccess file and managed to break my files completely. The system-wide Override setting prohibit that.
I could make server-wide changes, but with an eye toward users that can't I came up with a new, better solution.
I serve the images through PHP. That is about half the speed of native, but I can put on a proper Expires header. (And PHP doesn't put on its don't cache me ever headers if you have a image/png content type.)
That gets more portable and safer, but how about better? I set my images so they all expire out of cache at the same time. Now I won't have odd windows where some images have changed and others haven't. When one icon expires, they all expire. It goes like this…
<php? $icon = $HTTP_GET_VARS['icon'];$icons = array( 'edit' => 'images/edit.png', 'delete' => 'images/delete.png');
Header('Content-type: image/png'); Header('Expires: ' . gmdate('r', strtotime('next Sunday')));
fpassthru( fopen( $icons[$icon], 'r')); ?>
Then you can load icon.php?edit and get the PNG for the edit icon with these headers…
HTTP/1.1 200 OK Date: Wed, 12 Sep 2007 07:23:51 GMT Server: Apache/2.2.3 (Debian) … Expires: Sun, 16 Sep 2007 05:00:00 +0000 Content-Length: 164 Content-Type: image/png
When suddenly…
In the process of trying to see how tinyMCE got paste to work, and also realizing that I couldn't find the code they used to move the cursor in response to an arrow key I discovered contentEditable and its buddy designMode which Firefox will require. This is now a much easier problem. I will throw away all my beautiful code and just make a handful of API calls.
And just when I thought there was still a reason for giants to roam the earth.