Change the working directory of WebBrowser control?

  • Thread starter Thread starter Sin Jeong-hun
  • Start date Start date
S

Sin Jeong-hun

The situation is like this.
There is an XML in C:\SampleDirectory. I open the XML, modify it, then
transform it using an XSLT. Since I cannot write in C:
\SampleDirectory, I modified the XML on memory and save the
"transformed.html" in the Temp directory (let's say, C:\Temp
\transformed.html) and open it with a WebBrowser.

The problem is that original XML contains relative paths to images
which are saved in C:\SampleDirectory\Images. The WebBrowser is trying
to show the images in C:\Temp\Images, so images are not shown. Of
course I can manually edit each relative paths ("./") to hard-coded
paths (C:\Temp\Images\", but *if* I can tell the WebBrowser that the
current working is "C:\SampleDirectory" instead of the directory of
the opened HTML, it would be very easy and elegant.

Is this possible? Or should I change the text itself?
 
The situation is like this.
There is an XML in C:\SampleDirectory. I open the XML, modify it, then
transform it using an XSLT. Since I cannot write in C:
\SampleDirectory, I modified the XML on memory and save the
"transformed.html" in the Temp directory (let's say, C:\Temp
\transformed.html) and open it with a WebBrowser.

The problem is that original XML contains relative paths to images
which are saved in C:\SampleDirectory\Images. The WebBrowser is trying
to show the images in C:\Temp\Images, so images are not shown. Of
course I can manually edit each relative paths ("./") to hard-coded
paths (C:\Temp\Images\", but *if* I can tell the WebBrowser that the
current working is "C:\SampleDirectory" instead of the directory of
the opened HTML, it would be very easy and elegant.

Is this possible? Or should I change the text itself?

I forgot to post it here but right after I posted this question, I found the answer myself from Google.
The answer was the <base> tag.
 
Back
Top