I am having trouble displaying html onto a web browser. I am using the method "Deployment.Current.Dispatcher.BeginInvoke" but it wont displaying anything. What I am trying to do is getting html from a server as a string and displaying in my web browser. I can display messagebox but i cant send the string that contains html onto my web browser.
Here is the snippet of code that is giving me trouble:
Deployment.Current.Dispatcher.BeginInvoke(
() =>
{
WebBrowser webBrowser1 = new WebBrowser();
//MessageBox.Show(responseString);
webBrowser1.NavigateToString(responseString);
});
Asked
Active
Viewed 575 times
-1

John Saunders
- 160,644
- 26
- 247
- 397

Daniel Gopar
- 11
- 2
1 Answers
1
I think the reason for this error is because you're creating the WebBrowser
-instance inside your callback code - which you shouldn't do anyways (because how are you going to display it on the screen? If you are trying to go from your application into the main WebBrowser-app (IE), you should use WebBrowserTask
instead.
So either:
- you are trying to show a
WebBrowser
inside your application view (hybrid style). If so, you should call.NavigateToString(string html)
on theWebBrowser
you're displaying instead of creating another instance. - you are trying to show downloaded HTML in the main browser app on your phone (Internet Explorer). This can't be done by handing over the HTML directly, you would have to send it the URI-object where the browser can find it itself.
Or of course, the problem is somewhere else in your code. This is the best I could answer with the information and code you have provided.

John Saunders
- 160,644
- 26
- 247
- 397

Kris Selbekk
- 7,438
- 7
- 46
- 73
Hello world
"; ? – Kris Selbekk Aug 07 '12 at 22:43