Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents an URL.

Hierarchy

  • URL

Index

Constructors

constructor

  • new URL(url: string, base?: string | URL): URL
  • Creates and returns a URL object referencing the URL specified using an absolute URL string, or a relative URL string and a base URL string.

    Parameters

    • url: string
    • Optional base: string | URL

    Returns URL

Properties

hash

hash: string

The fragment identifier of the URL.

host

host: string

The domain (hostname). If a port was specified, followed by a colon and the port of the URL.

hostname

hostname: string

The domain of the URL.

href

href: string

The whole URL as string.

This has the same result as calling .toString().

Readonly origin

origin: string

Returns a string containing the origin of the URL (its scheme, domain and port).

password

password: string

The password specified before the domain name.

pathname

pathname: string

The pathname preceded by an initial '/'.

port

port: string

The port number of the URL.

protocol

protocol: string

The protocol of the URL, including the final colon.

search

search: string

A string indicating the parameter string of the URL. If any parameters are provided, this string includes all of them, beginning with the leading ? character.

Readonly searchParams

searchParams: URLSearchParams

A URLSearchParams object which can be used to access the individual query parameters found in search.

username

username: string

The username specified before the domain name.

Methods

toJSON

  • toJSON(): string
  • Returns a string containing the whole URL.

    This has the same result as accessing the .href property.

    Returns string

toString

  • toString(): string
  • Returns a string containing the whole URL.

    This has the same result as accessing the .href property.

    Returns string

Generated using TypeDoc