Change the working directory of WebBrowser control?

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?
 
J

Jeong-hun Sin

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top