Speed up and backup with Cloudflare Caching + Stay always online

Code to prevent caching on an update…

<script src="assets/js/custom.js?random=<?php echo $custom_js_filetime = filemtime('assets/js/custom.js'); ?>" type="text/javascript"></script>



function tstamp(date) { date=new Date(date); return date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear() + " " + date.getHours() +":"+ date.getMinutes()+":"+ date.getSeconds(); };
console.log("%cDate Indexfile: " + tstamp(<?=filemtime('index.php')?>), "color: red");
console.log("%cDate custom.js: " + tstamp(<?=$custom_js_filetime?>), "color: red");

This will log the filetime of the mainfile and the script into the js console inside your browser.

Leave a Reply