如何永久更改Windows Phone Webview的用户代理?
protected override void OnNavigatedTo(NavigationEventArgs e)
{
string ua = "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.20 Mobile Safari/537.36";
HttpRequestMessage hrm = new HttpRequestMessage(HttpMethod.Get, homeUri);
hrm.Headers.Add("User-Agent", ua);
webView.NavigateWithHttpRequestMessage(hrm);
}它在网页加载之前工作,但是如果我在user视图中打开一个子页面,它将使用标准的用户代理。
在此之前,非常感谢您。
发布于 2016-01-27 14:45:39
看看这里:Changing the user agent of the WebBrowser control
另一个可能的解决方案是拦截单击事件并更改HttpRequest消息,请参见此处:How can I detect when the user clicks on a hyperlink in a WebView control?
如果有用就告诉我!
https://stackoverflow.com/questions/35022029
复制相似问题