URLUtilsReadOnly

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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 for URLUtilsReadOnly.href.

Specifications

Specification Status Comment
URL
The definition of 'URLUtilsReadOnly' in that specification.
Living Standard Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support No No

57

3.5 — 571

No No No
hash No No

38

3.5 — 382

No No No
host No No3.5 No No No
hostname No No3.5 No No No
href No No3.5 No No No
origin No No29 No No No
pathname No No3.5 No No No
port No No3.5 No No No
protocol No No3.5 No No No
search No No3.5 No No No
toString No No3.5 No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No No No

57

4 — 571

No No No
hash No No No

38

4 — 382

No No No
host No No No4 No No No
hostname No No No4 No No No
href No No No4 No No No
origin No No No29 No No No
pathname No No No4 No No No
port No No No4 No No No
protocol No No No4 No No No
search No No No4 No No No
toString No No No4 No No No

1. Firefox has a bug whereby single quotes contained in URLs are escaped when accessed via URL APIs (see bug 1386683).

2. Before Firefox 38, Firefox returned the hash percent encoded. This has been fixed to match the spec.

See also





 
 
 

Document Tags and Contributors

Contributors to this page: connorshea, chrisdavidmills, teoli
Last updated by: connorshea,