0

When the application is accessed through auto suggest url of firefox, it loads the cached version of index html. But as soon as the user re-loads the page, it loads the latest version of index html properly.

I have used meta tags which is mentioned here.

Can we do something in javascript to completely disable cache?

Community
  • 1
  • 1
JPS
  • 2,730
  • 5
  • 32
  • 54

1 Answers1

0

You can disable the caching in your routes by using cache: false.

$stateProvider.state('yourState', {
   cache: false,
   url : '/yourUrl',
   templateUrl : 'yourTemplate.html',
   ...
});

Another way to force the reloading of your pages is to add a query param in each of your call (I do it in my services). It will be interpreted as a new URL.

For example: return '/home?' + Math.random();

Mistalis
  • 17,793
  • 13
  • 73
  • 97
  • Thanks for the suggestion. But the problem is, the new javascript will not be loaded as the index html itself is cached. just for example, my current index html has `` but the browser still loads ``. In this case, the above solution does not work for me:( – JPS Jan 24 '17 at 10:23
  • You can also do my trick on script loading: ``. Set `BUILD_NUMBER` as `Math.random()`. – Mistalis Jan 24 '17 at 10:25