BaseURL Property

Description

This property can be used to set the base URL used by EditLive! for XML to resolve relative URLs e.g. image URLs. The base URL property must be a URL for a virtual directory. The base URL property should be used in circumstances where it is impractical to set the <base> element of the configuration file. For example, when a single XML configuration file is used within a system where EditLive! for XML is used in multiple instances for editing pages with differing base URLs.

Syntax

JavaScript

setBaseURL(strBaseURL);

Parameters

strBaseURL

A string specifying the base URL to be used with this instance of EditLive! for XML. The URL should map to a virtual directory. The base URL is used by EditLive! for XML when resolving any relative URLs.

Example

Example 16.9. BaseURL Property Example Scripting

The following code would set the base URL for an instance of EditLive! for XML to http://www.yourserver.com/editor/. This URL will be used when resolving all relative URLs in the EditLive! for XML content and configuration file (e.g. URLs for images and links).

JavaScript

editlive_js.setBaseURL("http://www.yourserver.com/editor/");

Remarks

The base URL property must map to a virtual directory on a Web server and be a valid URL with a trailing /. For example http://www.yourserver.com/editor/ is a valid base URL however http://www.yourserver.com/editor is not.

Any value set in the <base> element of the EditLive! for XML configuration takes precedence over a value set through the base URL property. When using the base URL property to set the base URL it is recommended that you do not also set a value in the <base> element of the configuration file.

See Also