2

My Angularjs app works fine in Chrome but not in IE9 (haven't testing >IE9 yet).

I am fetching some data from the DB and displaying the results in a list. I can then delete the data and add new data saving to the DB each time. IE9 shows the original data that I started with even though when I look in the DB the data has changed as I would expect.

I assume this is down to caching behaviour in IE9 but I'm not sure how I should go about tackling this.

I'm using a MEAN stack. Any suggestions/advice would be great.

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
tommyd456
  • 10,443
  • 26
  • 89
  • 163
  • It might help if you could provide a minimal sample to demonstrate your problem that others could also try. Also, just because you have the MEAN stack does not mean you reference all of those tags. Your problem here seems to be with the "Angular" part, so keep it to that. – Neil Lunn Jun 25 '14 at 09:28
  • Caching behaviour can be influenced by the back end so I see that as relevant! – tommyd456 Jun 25 '14 at 09:29

1 Answers1

3

Answers from: Better Way to Prevent IE Cache in AngularJS?

in AngularJS this snippet should prevent response caching:

myModule.config(['$httpProvider', function($httpProvider) {
  //initialize get if not there
  if (!$httpProvider.defaults.headers.get) {
    $httpProvider.defaults.headers.get = {};    
  }
  //disable IE ajax request caching
  $httpProvider.defaults.headers.get['If-Modified-Since'] = '0';
}]);

Alternatively you could specify it in your backend that the response should not be cached, although the specific implementation of this depends on your backend implementation.

Community
  • 1
  • 1
M21B8
  • 1,867
  • 10
  • 20