W3cubDocs

/DOM

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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support No No 57
57
3.5 — 57
Firefox has a bug whereby single quotes contained in URLs are escaped when accessed via URL APIs (see bug 1386683).
No No No
hash No No 38
38
3.5 — 38
Before Firefox 38, Firefox returned the hash percent encoded. This has been fixed to match the spec.
No No No
host No No 3.5 No No No
hostname No No 3.5 No No No
href No No 3.5 No No No
origin No No 29 No No No
pathname No No 3.5 No No No
port No No 3.5 No No No
protocol No No 3.5 No No No
search No No 3.5 No No No
toString No No 3.5 No No No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support No No No 57
57
4 — 57
Firefox has a bug whereby single quotes contained in URLs are escaped when accessed via URL APIs (see bug 1386683).
No No No
hash No No No 38
38
4 — 38
Before Firefox 38, Firefox returned the hash percent encoded. This has been fixed to match the spec.
No No No
host No No No 4 No No No
hostname No No No 4 No No No
href No No No 4 No No No
origin No No No 29 No No No
pathname No No No 4 No No No
port No No No 4 No No No
protocol No No No 4 No No No
search No No No 4 No No No
toString No No No 4 No No No

See also





© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/URLUtilsReadOnly