MutableURL

interface MutableURL : URL

JavaScript: URL (Mutable)

The URL class is universally supported across JavaScript engines and browser implementations, and behaves similarly in each case; it is used for parsing well-formed URLs and extracting their constituent parts. This interface extends the built-in URL intrinsic interface with mutable properties, where supported by spec.

 

Mutable properties

Nearly all properties of URL objects are "mutable," meaning they can be assigned a new value. Under the hood, the URL controlled by an Elide URL intrinsic is immutable, and modifications are atomic. From the point of view of the JS guest code, the URL is mutable in-place, even though a new URL is created for each mutation.

The following properties are never mutable, because they are read-only by spec:

  • origin. This property is calculated from the current URL value.

  • searchParams. This property is likewise calculated from the current URL value.

See also

for information about URL objects in general, both mutable and immutable, and a full documentation of fields and methods available on each URL object.

Properties

Link copied to clipboard
abstract override var hash: String

From MDN: "The hash property of the URL interface is a string containing a '#' followed by the fragment identifier of the URL. The fragment is not percent-decoded. If the URL does not have a fragment identifier, this property contains an empty string — ""."

Link copied to clipboard
abstract override var host: String

From MDN: "The host property of the URL interface is a string containing the host, that is the hostname, and then, if the port of the URL is nonempty, a ':', followed by the port of the URL."

Link copied to clipboard
abstract override var hostname: String

From MDN: "The hostname property of the URL interface is a string containing the domain name of the URL."

Link copied to clipboard
abstract override var href: String

From MDN: "The href property of the URL interface is a string containing the whole URL."

Link copied to clipboard
abstract val origin: String

From MDN: "The origin read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.

Link copied to clipboard
abstract override var password: String

From MDN: "The password property of the URL interface is a string containing the password specified before the domain name. If it is set without first setting the username property, it silently fails."

Link copied to clipboard
abstract override var pathname: String

From MDN: "The pathname property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character. If the URL has no path segments, the value of its pathname property will be the empty string."

Link copied to clipboard
abstract override var port: Int?

From MDN: "The port property of the URL interface is a string containing the port number of the URL."

Link copied to clipboard
abstract override var protocol: String

From MDN: "The protocol property of the URL interface is a string representing the protocol scheme of the URL, including the final ':'."

Link copied to clipboard
abstract override var search: String

From MDN: "The search property of the URL interface is a search string, also called a query string, that is a string containing a '?' followed by the parameters of the URL."

Link copied to clipboard

From MDN: "The searchParams readonly property of the URL interface returns a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL."

Link copied to clipboard
abstract override var username: String

From MDN: "The username property of the URL interface is a string containing the username specified before the domain name."

Functions

Link copied to clipboard
abstract fun getMember(key: String): Any
Link copied to clipboard
open override fun getMemberKeys(): Array<String>
Link copied to clipboard
open override fun hasMember(key: String): Boolean
Link copied to clipboard
abstract fun putMember(key: String, value: Value)
Link copied to clipboard
open fun removeMember(key: String): Boolean
Link copied to clipboard
abstract fun toJSON(): String

Convert the URL to a JSON-compatible string; in practice, the return result is the same value as toString.

Link copied to clipboard
abstract override fun toString(): String

Generate a string representation of this URL object.