I'm having trouble clearing the WebView cache in a UWP application.
If I edit the contents of the JS file associated with my HTML page, I cannot get the change in my application unless I reinstall the application.
The static method of WebView.ClearTemporaryWebDataAsync () does not seem to work.
I also tried adding headers to the request to disable caching:
private void reloadPage()
{
string url = getUrl();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, new Uri(url));
request.Headers.Add("Cache-Control", "no-cache, no-store, must-revalidate");
request.Headers.Add("Pragma", "no-cache");
myWebView.NavigateWithHttpRequestMessage(request);
}
I also tried the following: on punt (I'm not sure if this affects the behavior of WebView caching), but still there is no joy:
private void onWebviewLoaded(object sender, RoutedEventArgs e)
{
Windows.Web.Http.Filters.HttpBaseProtocolFilter myFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
myFilter.CacheControl.WriteBehavior = Windows.Web.Http.Filters.HttpCacheWriteBehavior.NoCache;
myFilter.CacheControl.ReadBehavior = Windows.Web.Http.Filters.HttpCacheReadBehavior.Default;
WebView.ClearTemporaryWebDataAsync().AsTask().Wait();
reloadPage();
}
Any help would be greatly appreciated!
EDIT (14/12/15):
, ( ) , , . , , - .
, (, ), (, ).
EDIT (14/07/16): , , . - ...
CSS/JS , / . -, , , , , .