Force browser to cache file
Posted: Sun Dec 10, 2006 8:00 am
Thanks to Firebug I'm now seeing more stuff that's going on behind the screens of my websites. I noticed that my jquery.js.php file never gets cached. After copying the output to a plain text file called jquery.js, caching works and page loading speed dramatically increases.
Code: Select all
<?php
// This is the jquery.js.php file.
header('content-type: application/x-javascript');
// I guess I need some kind of cache-control header over here.
// However, tried some things without success.
require '../config.php';
require SHARED_DOCROOT .'js/jquery/jquery.js';
?>
$(document).ready(function(){
// Animate message box
$('#message').slideDown('normal');
// More jquery here...
});
});