Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 Safari/535.1 or something similar.

How to code that in C# to change the user agent string for the web browser control.

like image 792
Jeyanth Kumar Avatar asked Feb 22 '26 04:02

Jeyanth Kumar


2 Answers

Found a way webBrowser.Navigate("http://localhost/run.php", null, "User-Agent: Here Put The User Agent");

like image 198
Jeyanth Kumar Avatar answered Feb 23 '26 18:02

Jeyanth Kumar


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

like image 34
Leigh Avatar answered Feb 23 '26 16:02

Leigh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!