|
Posted by Jure Erznoznik on 06/20/05 10:23
I modified some of my javascript files to be PHP because I needed
translation (different languages for strings).
Of course, the files get translated fine, but I would like the browser to
keep them in cache, not reload them every single time.
Non-caching is triggered by headers Pragma, expires, etc, which I am
currently solving with this code:
<?php
session_start();
header("Content-type: text/javascript");
// Header("Expires: " . gmdate("D, d M Y H:i:s", mktime(5, 0, 0, 1, 1,
2020)) . " GMT");
Header("Expires: ");
Header("Cache-control: max-age=86400");
Header("Pragma: ");
This enables the browsers to recognise files as valid for 1 day, which is
good enough for me.
Is there a better way? How can I simply disable the Expires and Pragma
headers instead of setting them blank? I searched the manual all over but
can't find any function that would do this.
Thanks,
Jure
[Back to original message]
|