nx.js
Classes

URL

The URL interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL.

You normally create a new URL object by specifying the URL as a string when calling its constructor, or by providing a relative URL and a base URL. You can then easily read the parsed components of the URL or make changes to the URL.

Implements

Constructors

new URL()

new URL(url, base?): URL

Constructs a new URL object by parsing the specified URL.

Parameters

ParameterTypeDescription
urlstring | URLThe input URL to be parsed.
base?string | URLThe base URL to use in case the input URL is a relative URL.

Returns

URL

Properties

PropertyModifierTypeDescription
hashpublicstringMDN Reference
hostpublicstringMDN Reference
hostnamepublicstringMDN Reference
hrefpublicstringMDN Reference
originreadonlystringMDN Reference
passwordpublicstringMDN Reference
pathnamepublicstringMDN Reference
portpublicstringMDN Reference
protocolpublicstringMDN Reference
searchpublicstringMDN Reference
usernamepublicstringMDN Reference

Accessors

searchParams

get searchParams(): URLSearchParams

MDN Reference

Returns

URLSearchParams

Implementation of

globalThis.URL.searchParams

Methods

toJSON()

toJSON(): string

Returns a string containing the full URL. It is a synonym for the href property.

Returns

string

Implementation of

globalThis.URL.toJSON


toString()

toString(): string

Returns a string containing the full URL. It is a synonym for the href property, though it can't be used to modify the value.

Returns

string

Implementation of

globalThis.URL.toString


canParse()

static canParse(url, base?): void

Returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.

Parameters

ParameterTypeDescription
urlstring | URLThe input URL to be parsed.
base?string | URLThe base URL to use in case the input URL is a relative URL.

Returns

void

See

https://developer.mozilla.org/docs/Web/API/URL/canParse_static


createObjectURL()

static createObjectURL(obj): string

Returns a string containing a URL which represents the provided Blob object.

Parameters

ParameterTypeDescription
objBlobThe object for which an object URL is to be created.

Returns

string

See

https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static


revokeObjectURL()

static revokeObjectURL(url): void

Revokes an object URL previously created using URL.createObjectURL().

Parameters

ParameterTypeDescription
urlstringA string representing a URL that was created by calling URL.createObjectURL().

Returns

void

See

https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static

On this page