0

Is there any way, I can clear the views and scripts that are cached in user browser after some interval (eg: after 2 hrs) so that they don't need to clear their cache manually. I think, it's something that application may require when there some changes made on production but user don't see those updates until they clear their browser cache. Any suggestion, please?

Ammar Khan
  • 2,565
  • 6
  • 35
  • 60

1 Answers1

1

You'll have to involve the server, but at the end of every one of your scripts/partials/css attach a datetime that only updates every 2 hours (or whatever interval you want)

So to include angular it would be like this:

<script type="text/javascript" src=".../angular.js?12345"></script>

Then an hour later your server would change the time to this:

<script type="text/javascript" src=".../angular.js?12346"></script>

Or however you want to do it, this will force the user to go get the new data.

Mathew Berg
  • 28,625
  • 11
  • 69
  • 90
  • Thank you very much. So that means, there will be a separate api end point that will only return datetime during the time wen angular app loads up? – Ammar Khan Nov 27 '14 at 15:11