Clearing browser cache through script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2016 01:25 PM
Hi there,
Is there a way to clear the browser cache through script instead of loading 'cache.do' page manually. Can somebody please help me on this?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2019 02:19 AM
Hello,
We can clear the cache by writing a simple UI script and by calling a script include with the "gs.cacheFlush();" in it. Providing a sample code for reference.
Script Include:
clearCacheOnLoad: function()
{
if(!gs.hasRole('admin')){
gs.cacheFlush();
gs.info("cache cleared for non-admins");
}
},
UI Script code:
var ga = new GlideAjax('call script include with its name here');
ga.addParam('sysparm_name', 'clearCacheOnLoad');
ga.getXML();
Note: UI script runs every time a form loads in the instance.