2015-09-29 75 views
1

以下相同請求未到達服務器。我從角度使用$ http。我確信這些請求會被windows webview緩存,因爲在Android紋波中它不會緩存。如何在Cordova通用Windows Phone 8.1應用程序中禁用WebView緩存應用程序

我已經嘗試過這種請求/頭:

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

任何其他參數添加在GET請求URL不是服務器所允許。

回答

1

我想這對你來說這太晚了,但改變默認的HTTP標頭爲我工作:

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'; 
    }); 
相關問題