Page 1 of 1
Prevent table-tv.js Being Cached
Posted: 2018-10-05 02:53
by tandrew
Hi,
Does anyone know how to disable cache on table-tv.js magic hook file?
It seems every time made changes and the browser still cache on the old table-tv.js file
Thanks in advance.
Re: Prevent table-tv.js Being Cached
Posted: 2018-10-05 09:15
by tandrew
Hi,
Found the solution on others forum.
Hopefully this could help anyone facing the similar issue.
First input this JS script in footer-extra.php
Code: Select all
<script type="text/javascript" language="javascript">
var versionUpdate = (new Date()).getTime();
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "/hooks/tablename-tv.js?v=" + versionUpdate;
document.body.appendChild(script);
</script>
tablename-tv.js is where is = database table name
Lastly, clear any browser exiting cache and after that every changes on that particular tablename-tv.js file will not cache as the version keep changing itself.
Regards,
Andrew.