Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIStandardURL

This interface defines the interface to an URL with the standard file path format common to protocols like http, ftp, and file. It supports initialization from a relative path and provides some customization on how URLs are normalized.
Inherits from: nsIMutable Last changed in Gecko 1.9 (Firefox 3)

Implemented by: @mozilla.org/network/standard-url;1. To create an instance, use:

var standardURL = Components.classes["@mozilla.org/network/standard-url;1"]
                  .createInstance(Components.interfaces.nsIStandardURL);

Method overview

void init(in unsigned long aUrlType, in long aDefaultPort, in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI);

Attributes

Attribute Type Description
mutable boolean Control whether or not this URL can be modified. Protocol handlers can set this flag before handing out an URL to ensure that it is not inadvertently modified. Obsolete since Gecko 1.9

Constants

These constants describe how to normalize an URL.

Constant Value Description
URLTYPE_STANDARD 1
blah:foo/bar    => blah://foo/bar
blah:/foo/bar   => blah:///foo/bar
blah://foo/bar  => blah://foo/bar
blah:///foo/bar => blah:///foo/bar
URLTYPE_AUTHORITY 2
blah:foo/bar    => blah://foo/bar
blah:/foo/bar   => blah://foo/bar
blah://foo/bar  => blah://foo/bar
blah:///foo/bar => blah://foo/bar
URLTYPE_NO_AUTHORITY 3
blah:foo/bar    => blah:///foo/bar
blah:/foo/bar   => blah:///foo/bar
blah://foo/bar  => blah://foo/bar
blah:///foo/bar => blah:///foo/bar

Methods

init()

Normalizes a given URL to an Standard URL.

void init(
  in unsigned long aUrlType,
  in long aDefaultPort,
  in AUTF8String aSpec,
  in string aOriginCharset,
  in nsIURI aBaseURI
);
Parameters
aUrlType
One of the constants listed above.
aDefaultPort
If the port parsed from the URL string matches this port, then the port will be removed from the canonical form of the URL.
aSpec
URL string.
aOriginCharset
The charset from which this URI string originated. this corresponds to the charset that should be used when communicating this URI to an origin server, for example. if null, then provide aBaseURI implements this interface, the origin charset of aBaseURI will be assumed, otherwise defaulting to UTF-8 (that is, no charset transformation from aSpec).
aBaseURI
If null, aSpec must specify an absolute URI. Otherwise, aSpec will be resolved relative to aBaseURI.

See also

Document Tags and Contributors

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