nsIURLFormatter

This interface exposes methods to substitute variables in URL formats.
1.0
66
Introduced
Gecko 1.8
Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Variable names can contain 'A-Z' letters and '_' characters.

Mozilla applications linking to Mozilla websites are strongly encouraged to use URLs of the following format:

http[s]://%SERVICE%.mozilla.[com|org]/%LOCALE%/

Method overview

AString formatURL(in AString aFormat);
AString formatURLPref(in AString aPref);

Methods

formatURL()

Formats a string URL.

The set of known variables is predefined. If a variable is unknown, it is left unchanged and a non-fatal error is reported.

AString formatURL(
  in AString aFormat
);
Parameters
aFormat
Unformatted URL as a string.
Return value

The formatted URL.

formatURLPref()

Formats a string URL stored in a preference.

If the preference value cannot be retrieved, a fatal error is reported and the "about:blank" URL is returned.

AString formatURLPref(
  in AString aPref
);
Parameters
aPref
A string representing the name of the preference from which to fetch the URL to format.
Return value

The formatted URL returned by formatURL(), or "about:blank".