有没有办法激活控件 WebView 桌面模式而不是移动模式?
<WebView x:name= "WebViewApp" ..../>
WebView 没有固有的桌面或移动模式。站点是否提供移动或桌面优化站点通常基于用户代理标头。您可以通过创建一个 WebView 来设置它HttpWeb请求 https://msdn.microsoft.com/en-us/library/windows/apps/windows.web.http.httprequestmessage.aspx使用您想要的代理,然后使用 WebView 进行导航。使用 HttpRequestMessage 进行导航 https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.navigatewithhttprequestmessage.aspx.
如果您想模仿特定的浏览器模式,您可以在多个网站上找到它使用的用户代理。
string userAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop) like Gecko"
HttpRequestMessage httpRequestMessage = new HttpRequestMessage(
HttpMethod.Post, new Uri("http://whatsmyuseragent.com"));
httpRequestMessage.Headers.Append("User-Agent",userAgent);
myWebView.NavigateWithHttpRequestMessage(httpRequestMessage);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)