Re: Expiring other resources with HTTP headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tedd,

That's not exactly what I am looking for.  That would cause the
JavaScript file to be requested to the web server every single time.  I
just want the browser to request the file only when it have been
modified on the server.

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.

Thanks again,

-William


El lun, 27-02-2006 a las 11:12 -0500, tedd escribió:
> >I know I could reduce the expiration time to reduce this problem but
> >most of the time those files do not change.  What can I do to notify the
> >web browser that the file in the cache is no longer valid?
> >
> >-William
> 
> William:
> 
> Include this:
> 
> <?php # nocache.php
> // this script prevents all caching
> 
> // expires on any past date
> header ("Expires: Mon, 26 Jul 1997 05:00: GMT");
> 
> // last modified at current date and time
> header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
> 
> // for HTTP 1.1:
> header ("Cache-Control: no-store, no-cache, must-revalidate");
> header ("Cache-Control: post-check=0, pre-check=0", false);
> 
> // for HTTP 1.0
> header ("Pragma: no-cache");
> ?>
> 
> HTH's
> 
> tedd
> -- 
> --------------------------------------------------------------------------------
> http://sperling.com
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux