<link rel="stylesheet" type="text/css" href="css/style.css?v=<?php echo filemtime('css/style.css'); ?>" />
<script type="text/javascript" src="js/ajax.js?v=<?php echo filemtime('js/ajax.js'); ?>"></script>
As you can see it works for both css and js, very simple get type query which is meaningless to the files but just checks the when the file changed. So say you changed something recently that return of unix timestamp will change and now the browser is forced to download again instead of using the cached version.
Works pretty well so far, I will update if something changes but let me know if you found this useful/used it or anything related.
Thanks for visiting.
No comments:
Post a Comment