Absolute and Relative Paths in MSHTML
After reading of issues that MSHTML (or the DEC, the DHTML Editing Component) has with setting all paths to absolute, I felt I should divulge my solution: set the baseurl of the editor.
If using the DEC, where editor
is the id of the object try the following:
editor.BaseURL = "http://www.example.com/";
In doing so, any calls to an href
should now omit the base URL.
Conversation
I only use MSHTML (can't use active x components), and I couldn't get it to work. First, I think you mean the BaseHref property (instead of BaseURL).
If I create a link, then go to source code view, and then go back to wysiwyg mode, the relative links are still made absolute (using the base href).
Take a look at this:
http://www.netq.nl/mshtml
There is a relative link in the editable div. Click on copy to source code, it looks ok. Now click on copy to editable div. Now the link are made absolute as you can see when you click again on copy to source code.
Ah, yes. It seems you're right. In looking over my code, I can see that even with the DEC there were times that I had to strip out the base URL using something like this:
fvdvxc