How do i change the user Agent for Windows Phone Webview permanently?
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);
}
It works till the webpage loads, but if I open a subpage in the webview it uses the standard user agent.
Many thanks in advance.
Take a look here: Changing the user agent of the WebBrowser control
Another possible solution could be intercept the click event and change the HttpRequest message, see here: How can I detect when the user clicks on a hyperlink in a WebView control?
Let me know if it works!