Reputation: 2877
Im using some basic code to display a mobile website in my application using a web browser.
For some reason, if I use the standard browser it is sized correcly to 480 x 800 , but when I use the web browser in my application the page is way off more like 960 x 800.
Is there a way to force the size the page is displayed in the web browser?
The funny thing is that it was working a few months ago, but has suddenly gone haywire.
code is :
string site1 = "http://m.domain.com";
webBrowser1.Navigate(new Uri(site1, UriKind.Absolute));
webBrowser1.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(webBrowser1_Navigated);
I was thinking I could force user agent by using the below code, but I am getting errors " no overload for method, 'Navigate' takes 4 arguments.
webBrowser1.Navigate("http://localhost/run.php", null, null, "User-Agent: Windows Phone 7");
Page using app:
Page using standard IE9 browser outside of application, but on handset.
Upvotes: 0
Views: 1513
Reputation: 49395
One place to start would be to sniff the request/response. There's clearly different HTML coming back from the server for the two requests. For the in-app browser, it clearly says it's having trouble identifying the device. If you can figure out what is different between the two requests, you might be able to force the in-app browser to make the request more like the out-of-app browser.
If you're using the simulator, Fiddler is a fantastic tool for that sort of thing. The first place I'd look is at the User-Agent header, which most sites use to figure out what type of browser is requesting the page.
Upvotes: 1