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 compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support [1] 3.5 (1.9.1)[2] 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)[2] 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.

[2] Firefox has a bug whereby single quotes contained in URLs are escaped when accessed via URL APIs (bug 1386683). This has been fixed as of Firefox 57.

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