简体   繁体   中英

Http calls not working in IE11(working in chrome). Working when I delete temporary files

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-----------------------------

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"
    }
})

Add this to the header:

'If-Modified-Since': '0',
        "Pragma": "no-cache",
        "Expires": -1,
        "Cache-Control": "no-cache, no-store, must-revalidate"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM