Jump to content

[SOLVED] non cacheable java script/css


sastro

Recommended Posts

From PHP manual (http://www.php.net/manual/en/function.header.php):

 

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

 

After that you must print your javascript/css, but I think you don't need PHP to do this.... you can also do something like this:

 

<script src="myscript.js?rnd=<?=time()?>"></script>

 

It will print the current timestamp as a querystring for your js file, so the browser will always get the server version of the file and not from the local temporary dir.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.