Re: Expiring other resources with HTTP headers

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

 



William said:

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.

William:

I may not understand what you're trying to do -- but, perhaps using something like:

<?php echo "Last modified: " . date ("F d Y H:i:s.", getlastmod());?>

In concert with what I suggested might work.

tedd

ps: your email address has generated a couple of bounced blog stuff thus far.



 > 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


--
--------------------------------------------------------------------------------
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