Kavya Durgam

Kavya Durgam

  • NA
  • 26
  • 40k

how to clear the browser cache on the application load?

Jan 29 2018 1:47 AM

I am working on angular js application.

For the first time application is working fine, when we release a new build with new changes, when the user trying to access the page browser is still loading the old files new changes are showing in the browser, to load the new changes user has to clear the cache and reload the application.

Is there any way to clear the browser cache on the application load.

I am clearing the cache like below.

angular.module('myapp').run(function ($rootScope, $templateCache, $localStorage) { $rootScope.$on('$routeChangeStart', function (event, next, current) { $rootScope.$storage = $localStorage; if (typeof (current) !== 'undefined') { $templateCache.remove(current.templateUrl); } }); });

it is clearing the cache, but when any changes comes on the first load it is not clearing the browser cache.

Any help appreciated, thanks in advance.


Answers (2)