Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at


Interface implemented by objects capable of fixing up strings into URIs.
Inherits from: nsISupports Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6)

Implemented by:;1 as a service:

var uRIFixup = Components.classes[";1"]

Method overview

nsIURI createExposableURI(in nsIURI aURI);
nsIURI createFixupURI(in AUTF8String aURIText, in unsigned long aFixupFlags);
nsIURI keywordToURI(in AUTF8String aKeyword);


Constant Value Description
FIXUP_FLAG_NONE 0 No fixup flags.
FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP 1 Allow the fixup to use a keyword lookup service to complete the URI. The fixup object implementer should honour this flag and only perform any lengthy keyword (or search) operation if it is set.
FIXUP_FLAGS_MAKE_ALTERNATE_URI 2 Tell the fixup to make an alternate URI from the input URI, for example to turn foo into
FIXUP_FLAG_USE_UTF8 4 Use UTF-8 to encode the URI instead of the platform character set.



Converts an internal URI (for example a WYSIWYG URI) into one which we can expose to the user, for example on the URL bar.

nsIURI createExposableURI(
  in nsIURI aURI
The URI to be converted.
Return value

The converted, exposable URI, as an nsIURI.

Exceptions thrown
When we can not get a protocol handler service for the URI scheme.
When the exposable portion of aURI is malformed.


Converts the specified string into a URI, first attempting to correct any errors in the syntax or other vagaries. Returns a well formed URI or nsnull if it cannot.

nsIURI createFixupURI(
  in AUTF8String aURIText,
  in unsigned long aFixupFlags
Candidate URI.
Flags that govern ways the URI may be fixed up.
Return value

The converted URI.


Converts the specified keyword string into a URI. Note that it is the caller's responsibility to check whether keywords are enabled and whether aKeyword is a sensible keyword.

nsIURI keywordToURI(
  in AUTF8String aKeyword
The keyword to convert into a URI.
Return value

The converted URI.

See also

Document Tags and Contributors

 Contributors to this page: Sheppy
 Last updated by: Sheppy,