是否可以强迫我的页面在UWP Windows 8.1应用程序的Webview中以Internet Explorer 8兼容模式显示?
今天,我的Web应用程序通过POST接收请求,并显示仅与Internet Explorer 8兼容的内容:(
代码Web视图:
<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>
我是否可以强制页面显示为与Internet Explorer 8兼容
源自官方文档,您不能强制页面以Internet Explorer 8兼容模式显示。
根据要求,您可以将内容保存到html文件,然后使用Edge Browser打开它。并设置Edge兼容模式,如下所示。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句