1

I have a few http calls in angular controller which are fetching data from APIs and displaying it on front end using html5. It works perfectly fine in Chrome. It works perfectly fine for IE11 as well. but some times all data is 0 and I refresh/ hard refresh - data is not shown. However when I clear temp files from system, data comes again.

Controller file:-

     app.controller('contentController',function($rootScope,$window,
            $scope,$modal,$http,$filter,$cookieStore,$cookies,$timeout) {
    $scope.userId = $cookies.get('ClientID');
    $scope.Details=[];
    $http.get(databaseURL+'/categories').then(function(response){
        $scope.Details = response.data;

    });

App.js

    var express = require('express'), fs = require('fs'),
    http = require('http'), path = require('path'),passport = 
    require('passport'),SamlStrategy = require('passport-saml').Strategy;

   passport.serializeUser(function(user, done) {
      done(null, user);
    });
    passport.deserializeUser(function(user, done) {
      done(null, user);
    });

What I have tried:- 1. used cache control as per this link. but it is not helping.

https://community.esri.com/thread/187211-how-to-force-a-browser-cache-refresh-after-updating-wab-app

  1. Tried various hacks given in :- Angular IE Caching issue for $http

  2. Hard refresh also not working tried this as well JavaScript hard refresh of current page

nOTES:- 1. No. errors on console 2. When we see 'networks' tab in chrome / IE - it shows similar calls and completion in similar times.
3. Technologies used:- Angular js, html5 , css3 , Java, node. data coming from mongo db in the form of apis

Summary: - I need help to display data in IE11 without deleting temporary files. Like it does in chrome. When I display in IE11 with refresh + temp files deletion- It works smoothly. I don't want to intrude in user's browser and delete temporary file just for the sake of IE11.

Thanks in advance for any clues.

-----------------adding minor requirement-------------------

Refresh thing is more or less resolved(still there to some extent). However, when I move into some other page and come back to content page - it breaks.

----------------end of revision-----------------------------

Mayank Parnami
  • 317
  • 1
  • 3
  • 13

2 Answers2

0

Please try this,

$http.get("your api url", {
    headers: {
        'If-Modified-Since': '0',
        "Pragma": "no-cache",
        "Expires": -1,
        "Cache-Control": "no-cache, no-store, must-revalidate"
    }
})
chinmayan
  • 1,304
  • 14
  • 13
  • Thanks for your quick response .It worked for refresh scenario. However on going to some other page and coming back to this contents page:- It breaks again and data become 0(resets again). Can you please help me in that as well. Thanks in advance :) – Mayank Parnami May 14 '18 at 09:54
  • @MayankParnami okay, let me see. So when you go to your other page and come back, is the api firing again? – chinmayan May 15 '18 at 04:13
  • api does not fire at that time. Hence it affect chart loading. This behavior is inconsistent as well. However for chrome it works perfectly – Mayank Parnami May 15 '18 at 08:59
0

Add this to the header:

'If-Modified-Since': '0',
        "Pragma": "no-cache",
        "Expires": -1,
        "Cache-Control": "no-cache, no-store, must-revalidate"
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Hilal Aissani
  • 709
  • 8
  • 3