【发布时间】:2019-03-10 19:28:31
【问题描述】:
应用显示一个带有 WebView 的网站。 该站点有一个返回按钮可以导航,但是当我点击它时它会显示此错误:
网页已过期。主要原因:手机上的页面副本没有更新,网站请求更新才能看到 信息
我的 WebView 请求代码:
var request = new Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.Post, new Uri("http://example.com/index.php"));
IHttpContent content = new HttpFormUrlEncodedContent(new [] { (new KeyValuePair<string, string>("param", myParam)) });
request.Content = content;
webView.NavigateWithHttpRequestMessage(request);
我在 Xamarin.Android 应用程序上遇到了类似的问题,我解决了将此代码添加到 WebView:
webView.Settings.SetAppCacheEnabled(true);
webView.Settings.SetAppCacheMaxSize(8 * 1024 * 1024);
webView.Settings.CacheMode = CacheModes.CacheElseNetwork;
我尝试查看 UWP 的类似配置,但没有找到任何相关信息。
有人可以帮助我吗? 提前谢谢你。
【问题讨论】:
标签: c# xamarin webview xamarin.forms uwp