I am using php for generating javascript dynamically based on different conditions. I want browser to be able to cache it for specific amount of time.
I am using the following code for caching, but it doesn't seem to be working.
header("Content-type: text/javascript; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
header($ExpStr);
Also, The js file is quite big, ~290 KBs, So I want to send it compressed to the browser to reduce download time. any suggestions?