Prevent table-tv.js Being Cached

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
tandrew
Posts: 12
Joined: 2018-09-26 12:46

Prevent table-tv.js Being Cached

Post by tandrew » 2018-10-05 02:53

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.

tandrew
Posts: 12
Joined: 2018-09-26 12:46

Re: Prevent table-tv.js Being Cached

Post by tandrew » 2018-10-05 09:15

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.

Post Reply