Prasanna Aarthi
Prasanna Aarthi

Reputation: 3453

Set user agent for web browser control to display mobile version of website- windows phone 8

I need to display some URL's inside web browser controls.For some sites the mobile version is not displayed even though it is available.I am using the following code to set the user agent

 webBrowser1.Navigate(
     new Uri(
         "http://www.linkedin.com/groups/NET-Developers-40949"
     ),
     null,
     "User-Agent:Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7"
 );

Still only desktop version is rendered.Any help? And is there any way to set the user agent for the entire session?

Upvotes: 1

Views: 1985

Answers (1)

Michael Olafusi
Michael Olafusi

Reputation: 26

I have the exact problem, trying to make the webBrowser control display the mobile version of the sites I navigate to. In searching for the answer, I came across your question here.

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"

We have Aditya Patil to thank.

Upvotes: 1

Related Questions