我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use 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 spec 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 | Not supported [1] | 3.5 (1.9.1) | Not supported [1] | Not supported [1] | Not supported [1] |
origin |
? | 29 (29) | ? | ? | ? |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | Not supported [1] | Not supported [1] | 1.0 (1.9.1) | Not supported [1] | Not supported [1] | Not supported [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
.