Change user agent in WP8.1 WebView

后端 未结 2 1722
旧巷少年郎
旧巷少年郎 2020-12-21 18:07

This is for Windows Phone. I\'m using windowsphone8.1 update 1. you know that the web interface works like that of android and iOS. How do I get the same interface in my wp8

2条回答
  •  甜味超标
    2020-12-21 18:35

    An alternative in this post https://social.msdn.microsoft.com/Forums/en-US/e7954cf9-88ba-4318-aebf-f528ade5c13d/still-no-way-to-set-ua-string-in-81-webview?forum=w81prevwCsharp answered by _Pete

    HttpRequestMessage httpRequestMessage = 
    new HttpRequestMessage(HttpMethod.Post, new Uri("website"));
    httpRequestMessage.Headers.Append("User-Agent", 
                    "Custom User-Agent"); 
    
    webView.NavigateWithHttpRequestMessage(
    httpRequestMessage);
    

    Obviously it works for one Uri

提交回复
热议问题