nsIStandardURL 编辑
netwerk/base/public/nsIStandardURL.idl
Scriptable 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 provideaBaseURI
implements this interface, the origin charset ofaBaseURI
will be assumed, otherwise defaulting to UTF-8 (that is, no charset transformation fromaSpec
). aBaseURI
- If
null
,aSpec
must specify an absolute URI. Otherwise,aSpec
will be resolved relative toaBaseURI
.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论