我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The URLUtilsReadOnly
interface defines utility methods to work with URLs. It defines only non-modifying methods intended to be used on data that cannot be changed.
There are no object of this type, but several interface are implemented it, like WorkerLocation
.
Properties
This interface doesn't inherit any property.
URLUtilsReadOnly.href
Read only- Is a
DOMString
containing the whole URL. URLUtilsReadOnly.protocol
Read only- Is a
DOMString
containing the protocol scheme of the URL, including the final':'
. URLUtilsReadOnly.host
Read only- Is a
DOMString
containing the host, that is the hostname, a':'
, and the port of the URL. URLUtilsReadOnly.hostname
Read only- Is a
DOMString
containing the domain of the URL. URLUtilsReadOnly.origin
Read only- Returns a
DOMString
containing the canonical form of the origin of the specific location. URLUtilsReadOnly.port
Read only- Is a
DOMString
containing the port number of the URL. URLUtilsReadOnly.pathname
Read only- Is a
DOMString
containing an initial'/'
followed by the path of the URL. URLUtilsReadOnly.search
Read only- Is a
DOMString
containing a'?'
followed by the parameters of the URL. URLUtilsReadOnly.hash
Read only- Is a
DOMString
containing a'#'
followed by the fragment identifier of the URL.
Methods
This interface doesn't inherit any method.
URLUtilsReadOnly.toString()
- Returns a
DOMString
containing the whole URL. It is a synonym forURLUtilsReadOnly.href
.
Specifications
Specification | Status | Comment |
---|---|---|
URL The definition of 'URLUtilsReadOnly' in that specification. |
Living Standard | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | No support [1] | 3.5 (1.9.1) | No support [1] | No support [1] | No support [1] |
origin |
? | 29 (29) | ? | ? | ? |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | No support [1] | No support [1] | 1.0 (1.9.1) | No support [1] | No support [1] | No support [1] |
origin |
? | ? | 29.0 (29) | ? | ? | ? |
[1] Though not grouped in a single abstract interface, these methods are directly available on the interfaces that implement it, if this interface is supported.
See also
- Other URL-related interfaces:
URL
,URLUtils
, andURLQuery
. - Interfaces implementing this one:
WorkerLocation
.