William Lovaton wrote:
Let's say that by default, those JavaScript files expires every 4 hours and that when a PHP program regenerates the file in the server it should, somehow, notify the web browser that the file changed and that it should request that file the next time it reloads the page or else the user will be seeing an outdated menu. I am almost sure this is not posible using HTTP headers. The only way I see this could be achieved is by sending some random parameter to the JS file so that the browser thinks it is a different file. This was suggested by David Tulloh in a previous email.
The best way I've found to do this is to put the file modification time in the querystring for the JS file. Set the expiry for that file to 365 days (or whatever) using Apache. That way you don't need to do anything when you update the JS file for it to be rolled out and the only cost per request is looking up the file modification time.
Another way to do it is to store the version number actually in the JS filename itself. This would have the added benefit of being able to quickly rollback to a previous version if needed.
Hope that helps. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php