Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

relative URLs

1 view
Skip to first unread message

Adrian Cope

unread,
Feb 4, 2002, 3:55:50 PM2/4/02
to
When using the MSHTML in a web page, I can't get it to handle relative
URLS's properly.

My URL structure looks like this:

htp://server/edit_inc/ <- editing includes and files
/images/ <- image directory
/pages/ <- user pages.

I want to be able to place an image in the document with a relative URL of
../images/xyz.jpg but the Edit component only ever displays the broken image
symbol. If I save the document, then browse to a page in /pages/ and pull
that page out of the database, the image is displayed correctly, so the path
is correct.
I have tried the following techniques:

Placing a <base href="htp:/server/edit_inc/"> in the head
specifying contentElement.BaseUrl = "htp:/server/edit_inc/" when the edit
object is created.

I can solve the problem by using absolute paths, but I don't want to do
this, as often clients are entering real data into a preproduction staging
server prior to the real server going live. Relative URL keeps the data
portable between websites.

Thanks in advance,
Adrian

Adrian Cope

unread,
Feb 4, 2002, 4:15:19 PM2/4/02
to
Solved it by setting the BaseURL property AFTER I've loaded the document.
BTW - I loaded the document by using contentElement.documentHTML =
"blah....."
As this means I can pull in the page from the DB at the same time as loading
the editor, and not have to go fetch it afterwards.

TTFN

"Adrian Cope" <a...@NOSPANadriancope.net> wrote in message
news:#JvSa5brBHA.2208@tkmsftngp05...

ALX

unread,
Feb 6, 2002, 1:53:30 AM2/6/02
to

hi can u show an example of how to do it?
have same problem, using editable DIV(MSHTML control)


thanx

"Adrian Cope" <a...@NOSPANadriancope.net> wrote in message

news:Odz8SEcrBHA.1864@tkmsftngp07...

Adrian Cope

unread,
Feb 6, 2002, 4:07:23 PM2/6/02
to
"ALX" <drak...@yahoo.com> wrote in message
news:#eB2gmtrBHA.2712@tkmsftngp05...

>
> hi can u show an example of how to do it?
> have same problem, using editable DIV(MSHTML control)
>

I use apache/PHP webserver - the <?=$doc_copy?> is the output from a
database and has been stripped of newlines, and has had quotes backslashed.
<?=$doc_path?> is the the current path, i.e. http://myserver/images/
You can do the same thing easily in ASP, or in JavaScript on the client
side.
function MENU_FILE_OPEN_onclick() {
tbContentElement.documentHTML= "<?=$doc_copy;?>"
tbContentElement.BaseURL="<?=$doc_path?>"
tbContentElement.focus();
tbContentElement.BrowseMode = true;
}

ALX

unread,
Feb 7, 2002, 12:36:39 AM2/7/02
to
tbContentElement - editable object?

function init()
{
preLoadedDoc= document.frm.sArea.value; // eFre -- editable DIV
document.frm.sArea.value= self.opener.document.frm.TEXT.value;// textarea
with source code
eArea.innerHTML = document.frm.sArea.value;

eArea.document.designMode = "On"
////////
eArea.document.BaseURL = bas;
eArea.BaseURL = bas;
document.BaseURL = bas;
////////////////////////////
}

Dont work for me :((( when i try to change source code of TAG(img, a href)
in textarea to relative, after swiching to edit mode it converts to absolute
:(((


"Adrian Cope" <a...@NOSPANadriancope.net> wrote in message

news:eP3qQJ1rBHA.2224@tkmsftngp03...

0 new messages