URL spoofing in WebBrowser

Let's say I get the source code of some page (e.g. http://example.com ). Now I want to write this source code to WebBrowser using something like:

myWebBrowser.Navigate("about:blank");
myWebBrowser.Document.Write(sourceCode);

Now suppose there is a relative URL on the Example.com homepage, for example:

<img src="/logo.gif" />

WebBrowser will try to download it from about:blank/logo.gif. I want to tell WebBrowser that "current address" http://example.com, so that it uses instead http://example.com/logo.gif.

Writing directly to the Url WebBrowser property will cause navigation (), which will get rid of the text that 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., and not just images.

Is it possible?

+3
3

<base> : http://www.w3.org/TR/html4/struct/links.html#edef-BASE

, , <head>, :

<head><base href="http://example.com"/>

, <base>, .

+5

URL , , .

HTML "" URL , <BASE> tag.

, , .

+3

You can enter <BASE>in your code and indicate that the base is http://example.com

+3
source

Source: https://habr.com/ru/post/1730171/


All Articles