Search code examples
javascriptcachingwakanda

Prevent user browsers from caching Wakanda pages?


I am looking for strategies to prevent user web browsers from caching my Wakanda pages and scripts. I am finding lately as I fix problems, I have to ask users to clear their cache which is really something I'd like to save them from having to do. Do you have any suggestions how I can prevent their browsers from caching my pages? Thank you.


Solution

  • We've encountered a few caching issues so far and have found that disabling the Wakanda Cache can sometimes help in these scenarios.

    Under your Common App settings, uncheck 'Use Page Cache'. Of course, this is the Wakanda Server side cache, so if there's a local caching issue happening, this won't help you. However this often helps even with client-side cache problems.

    As @gaetanoM suggested, you can also force the Cache-Control headers to force the client side to not cache in the browser. Using jquery is easy enough with:

    this.http_request.setRequestHeader("Cache-Control", "no-cache");

    If you need to see an example of how Wakanda sets this out-of-the-box, take a look at the angular-wakanda-debug.js file or Rest.js file in the lib directory as the default debugging mode disables the cache itself.