2

I'm developing Silverlight OOB application and I need to show web pages in it - I would like to do it through out WebBrowser control, but during page load I get lots of MessageBoxes with JavaScript errors.

Is there a way of hiding those MessageBoxes?

In winform WebBrowser control there is ScriptErrorsSuppressed property that can be used, but in SL there isn't.

I would be appreciated for any help.

2 Answers 2

1

Try turning off script debugging in the internet explorers advanced settings. Ultimately the control uses MSHTML to deliver the rendering, which in turn gets many of it settings from IE.

Sign up to request clarification or add additional context in comments.

2 Comments

I have disabled script debugging in IE, but the problem still occurs. So it's a problem with the control.
I have a feeling that this can be done through reflection, but I don't see any good method for that ;)
1

Today I've returned to this problem in my app and I was able to resolve it somehow. Because I need to show only a pages - without much user interaction on those pages - I solve it this way.

In code I create a html with iframe with attribute security="restricted" and then I inject url to this iFrame.

My code looks like this:

var html = new StringBuilder(@"<html xmlns=""http://www.w3.org/1999/xhtml"" lang=""EN""> 
                                            <head> 
                                            <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" /> 
                                            <title>{@pageTitle}</title> 
                                            <style type=""text/css""> 
                                            html {overflow: auto;} 
                                            html, body, div, iframe {margin: 0px; padding: 0px; height: 100%; border: none;} 
                                            iframe {display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden;} 
                                            </style> 
                                            </head> 
                                            <body> 
                                            <iframe id=""tree"" name=""tree"" security=""restricted"" src=""{@PageLink}"" frameborder=""0"" marginheight=""0"" marginwidth=""0"" width=""100%"" height=""100%"" scrolling=""auto""></iframe> 
                                            </body> 
                                            </html>");
html.Replace("{@pageTitle}", Title);
html.Replace("{@PageLink}", uri.ToString());

and then I'm using NavigateToString method of WebBrowser to load my html to it.

P.S. I've added this as an answer to accept this question.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.