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

PropertyModifierType
hashpublicstring
hostpublicstring
hostnamepublicstring
hrefpublicstring
originreadonlystring
passwordpublicstring
pathnamepublicstring
portpublicstring
protocolpublicstring
searchpublicstring
usernamepublicstring

Accessors

searchParams

get searchParams(): URLSearchParams

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


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

On this page