Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.window.d.ts>Location

A modern runtime for JavaScript and TypeScript.
Go to Latest
interface Location
import { type Location } from "https://deno.land/x/deno@v1.36.0/cli/tsc/dts/lib.deno.window.d.ts";

The location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Accessible via globalThis.location.

Properties

readonly
ancestorOrigins: DOMStringList

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

Always empty in Deno.

hash: string

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

Cannot be set in Deno.

host: string

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

Cannot be set in Deno.

hostname: string

Returns the Location object's URL's host.

Cannot be set in Deno.

href: string

Returns the Location object's URL.

Cannot be set in Deno.

readonly
origin: string

Returns the Location object's URL's origin.

pathname: string

Returns the Location object's URL's path.

Cannot be set in Deno.

port: string

Returns the Location object's URL's port.

Cannot be set in Deno.

protocol: string

Returns the Location object's URL's scheme.

Cannot be set in Deno.

Methods

toString(): string
assign(url: string): void

Navigates to the given URL.

Cannot be set in Deno.

reload(): void

Reloads the current page.

Disabled in Deno.

deprecated
reload(forcedReload: boolean): void
replace(url: string): void

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

Disabled in Deno.

variable Location
import { Location } from "https://deno.land/x/deno@v1.36.0/cli/tsc/dts/lib.deno.window.d.ts";

The location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Accessible via globalThis.location.

type

{ readonly prototype: Location; new (): never; }