Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Location

The location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively.

interface Location {
readonly ancestorOrigins: DOMStringList;
hash: string;
host: string;
hostname: string;
href: string;
readonly origin: string;
pathname: string;
port: string;
protocol: string;
search: string;
assign(url: string | URL): void;
reload(): void;
replace(url: string | URL): void;
toString(): string;
}
var Location: {
prototype: Location;
new (): Location;
}
;

§Properties

§
readonly ancestorOrigins: DOMStringList
[src]

Returns a DOMStringList object listing the origins of the ancestor browsing contexts, from the parent browsing context to the top-level browsing context.

§
hash: string
[src]

Returns the Location object's URL's fragment (includes leading "#" if non-empty).

Can be set, to navigate to the same URL with a changed fragment (ignores leading "#").

§
host: string
[src]

Returns the Location object's URL's host and port (if different from the default port for the scheme).

Can be set, to navigate to the same URL with a changed host and port.

§
hostname: string
[src]

Returns the Location object's URL's host.

Can be set, to navigate to the same URL with a changed host.

§
href: string
[src]

Returns the Location object's URL.

Can be set, to navigate to the given URL.

§
readonly origin: string
[src]

Returns the Location object's URL's origin.

§
pathname: string
[src]

Returns the Location object's URL's path.

Can be set, to navigate to the same URL with a changed path.

§
port: string
[src]

Returns the Location object's URL's port.

Can be set, to navigate to the same URL with a changed port.

§
protocol: string
[src]

Returns the Location object's URL's scheme.

Can be set, to navigate to the same URL with a changed scheme.

§Methods

§
assign(url: string | URL): void
[src]

Navigates to the given URL.

§
reload(): void
[src]

Reloads the current page.

§
replace(url: string | URL): void
[src]

Removes the current page from the session history and navigates to the given URL.

§
toString(): string
[src]