I'm creating an app on Windows Phone 7 that lets folks read offline HTML content. Is there a way to show an inline browser or HTML viewing control?
The WebBrowser
control allows you to display arbitrary HTML.
There are two methods on the WebBrowser
control you can use to display HTML:
Navigate()
will display the contents of a file located at the supplied URL. This file can be in IsolatedStorage
or on a server.NavigateToString()
will display the html string you give it.In your case I'm guessing you'd use a WebClient
object to download the webpage to offline storage, then the Navigate
method to display it.
However, the benefit of NavigateToString
is that you can munge the string on the way in to do some cool (or essential) stuff like style the page so it matches perfectly with the current phone theme, or catch all link clicks and make them pop in the external browser (otherwise they load in the very same WebBrowser
control).
I've documented the details of styling and link clickery here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With