Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular-poller doesn't work on IE11 when the development tool is not opened

I am working on an angular v1.3 app and I am using angular-poller in one my controllers to automatically send request to get new data from my backend every 2 seconds.

It works fine in Chrome, but does not work in IE11. But strangely enough, I am using the Fiddler to see if the requests are sent out when I using IE11, I can see that on IE 11, if the development tools window is opened, then the requests are sent through, and my app works properly, but if I don't open the development console, requests are not even being made, at least it is what fiddler shows me.

    poller.get(myResourceService, { action: 'get',
                  argumentsArray: [{
                    id: $stateParams.id
                  }],
                  delay: '2000',
                  smart:true })
  .promise.then(null, null, function(result) {
    $scope.details= result;
  });

The above is the code I have in my controller. It is really an annoying issue, and I have spent hours on it. So, any help would be very appreciated.

Cheers

like image 290
loveNZ Avatar asked Sep 29 '22 01:09

loveNZ


1 Answers

What i found with IE is that they cache AJAX call & when you using Fiddler/Development tools it will behave differently ie not caching AJAX Call. In order to resolve this issue, i usually add Cache-Control header in the response header and fill it with "no-cache".

Check this link for more detail How to control web page caching, across all browsers?

like image 149
kwangsa Avatar answered Oct 20 '22 11:10

kwangsa