Setting up WebBrowser.DocumentText without navigation: about

When you set this property, the WebBrowser control automatically navigates to: empty url before loading the specified text. This means that the Navigating, Navigated, and DocumentCompleted events are raised when you set this property and the value of the Url property no longer makes sense.

https://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext(v=vs.110).aspx


Let's say I first want to download a local .html file using Browser.Url = new Uri(some filePath.html);

This HTML file contains links like <script src="../Content/Scripts/ThisView.js"></script>

It works well. Since the Url is installed.

Then I want to manipulate the document with HtmlAgilityPack

or w / e and download the new content with the installer DocumentText

without losing it Browser.Url

(so script links etc. will get corrupted).

Is there a way to get around this, or do I need to overlay links in the document as well?

+3


source to share





All Articles