【发布时间】:2019-08-07 04:21:57
【问题描述】:
是否可以强制我的页面在 UWP Windows 8.1 应用程序的 Web 视图中以 Internet Explorer 8 兼容模式显示?
今天我的网络应用程序通过 POST 接收请求并显示仅与 Internet Explorer 8 兼容的内容:(
代码网页视图:
<WebView x:Name="MyWebView" Source="" />
代码 C# UWP:
string url = "https://www.exampleapp.net/app/";
string postBody = string.Format("keyvalue=param1&keyvalue2={0}", someValue);
StringContent postBodyEncoded = new StringContent(postBody, Encoding.UTF8, "application/x-www-form-urlencoded");
HttpClientHandler handler = new HttpClientHandler();
handler.AllowAutoRedirect = true;
HttpClient client = new HttpClient(handler);
HttpResponseMessage res = await client.PostAsync(url, postBodyContent);
var content = await res.Content.ReadAsStringAsync();
MyWebView.NavigateToString(content);
我的页面:
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>My Web Page</title>
<script src="https://www.exampleapp.net/app/script.js"></script>
</head>
<body>
<p>Dynamic Content.</p>
</body>
</html>
【问题讨论】: