Windows phone 7 web browser control user agent
The present user agent for the browser control that i see in the emulator is Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; Microsoft; XDeviceEmulator)
and i want to change that to Mozilla/5.0 Windows NT 6.1 AppleWebKit/535.1 KHTML, like Gecko Chrome/14.0.835.187 Saf开发者_如何学Goari/535.1
or something similar.
How to code that in C# to change the user agent string for the web browser control.
Found a way webBrowser.Navigate("http://localhost/run.php", null, "User-Agent: Here Put The User Agent");
In Windows Phone 7.5, there is a Navigate method overload that allows setting the headers. There are 3 arguments ( URI, post_info, header_info) , not 4 as shown.
The overload worked for me.
Good luck. -e
In the end I found an unbelievably simple answer, and that worked.
All you need do is to edit the Web Browser Control XAML. Add the property IsScriptEnabled="True"
Hope this solutions helps.
Would be something like this, in vb:
WebBrowser.Navigate(New Uri("URL"), byteArr, HttpRequestHeader.UserAgent & ":" & "Mozilla/5.0 (Linux; U; Android 2.3.4; fr-fr; HTC Desire Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1")
However, I cannot modify the headers already appended to the request, you can only add them, which I find pretty annoying.
Anyone have succeeded in doing this??
精彩评论