Let's say I get the source code of some page (e.g. http://example.com). I now want to write this source code to a WebBrowser, using something like:
myWebBrowser.Navigate("about:blank");
myWebBrowser.Document.Write(sourceCode);
Now, let's pretend that on the homepage of Example.com, there's a relative URL such as:
<img src="/logo.gif" />
The WebBrowser will attempt to load it from about:blank/logo.gif
. I want to tell the WebBrowser that the "current address" is http://example.com
so that it uses http://example.com/logo.gif
instead.
Writing directly to the Url property of the WebBrowser will cause a Navigate(), which will get rid of any text I wrote.
I am looking for a solution that works for other elements as well such as stylesheets, javascript (e.g. <script language="text/javascript" src="myscript.js">
), links, etc., not just images.
Is this possible?