tvelop
tvelop

Reputation: 348

How to disable WebView Cache in Cordova Universal Windows Phone 8.1 App

Following same requests doesn't reach the server. I am using $http from angular. I am sure the requests get cached by the windows webview, because in Android ripple it does not cache.

I already tried this request/header:

var request = {
        withCredentials: true,
        cache: false,
        headers: {
            'Cache-Control': 'no-cache',
            'If-Modified-Since': 'Mon, 26 Jul 1997 05:00:00 GMT',
            'Pragma': 'no-cache',
            'timestamp': timestamp,
        },
        method: 'GET',
        url: targetUri,
    }

Any other parameter added to url in get request isn't allowed by the server.

Upvotes: 1

Views: 671

Answers (1)

kutomer
kutomer

Reputation: 734

I guess that it's too late for you, but changing the default http headers worked for me:

app.config(
    function ($stateProvider, $urlRouterProvider, $httpProvider) {
        if (!$httpProvider.defaults.headers.get) {
          $httpProvider.defaults.headers.get = {};
        }

        $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
        $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
        $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';
    });

Upvotes: 1

Related Questions