I do not know how to force the WebBrowser control to ignore this tag and not override the registry settings. For a quick (dirty) workaround, you can do the following.
Create a query for the site that you want to display in the WebBrowser control.
var requestUri = new Uri("http://stackoverflow.com/"); var request = (HttpWebRequest) WebRequest.Create(requestUri);
Get an answer.
var response = request.GetResponse(); using (var stream = response.GetResponseStream()) using (var reader = new StreamReader(stream)) { var html = reader.ReadToEnd();
Use NuGet to install HTMLAgilityPack.
http://nuget.org/packages/HtmlAgilityPack
Download the HTML that you just returned into the HtmlDocument instance.
var document = new HtmlAgilityPack.HtmlDocument(); document.LoadHtml(html);
Select a tag. Here I use StackOverflow.com as an example and instead select its node stylesheet. When found, just remove the node.
var nodes = document.DocumentNode.SelectNodes("//link[@rel=\"stylesheet\"]"); foreach(var node in nodes) { node.ParentNode.RemoveChild(node); }
All that remains is to get the modified HTML code and directly pass it to the WebBrowser control.
html = document.DocumentNode.OuterHtml; webBrowser.DocumentText = html;
He cannot interpret that which does not exist.
You can do the same to solve your problem. Run the request, get the answer, change the HTML and submit it to the WebBrowser control. The tested seems to load the rest of the document in order.
source share