sastro Posted July 22, 2009 Share Posted July 22, 2009 How to create non cacheable java script/css with PHP header? Its to avoid the file stored to temporary internet file.. Link to comment https://forums.phpfreaks.com/topic/166892-solved-non-cacheable-java-scriptcss/ Share on other sites More sharing options...
celsoendo Posted July 22, 2009 Share Posted July 22, 2009 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. Link to comment https://forums.phpfreaks.com/topic/166892-solved-non-cacheable-java-scriptcss/#findComment-879980 Share on other sites More sharing options...
sastro Posted July 22, 2009 Author Share Posted July 22, 2009 Ok. Thx buddy for help... Link to comment https://forums.phpfreaks.com/topic/166892-solved-non-cacheable-java-scriptcss/#findComment-880023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.