Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface 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.

Hierarchy

  • Location

Index

Properties

Readonly ancestorOrigins

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.

hash

hash: string

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

host: string

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

hostname: string

Returns the Location object's URL's host.

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

href

href: string

Returns the Location object's URL.

Can be set, to navigate to the given URL.

Readonly origin

origin: string

Returns the Location object's URL's origin.

pathname

pathname: string

Returns the Location object's URL's path.

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

port

port: string

Returns the Location object's URL's port.

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

protocol

protocol: string

Returns the Location object's URL's scheme.

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

search

search: string

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

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

Methods

assign

  • assign(url: string): void
  • Navigates to the given URL.

    Parameters

    • url: string

    Returns void

reload

  • reload(): void
  • reload(forcedReload: boolean): void
  • Reloads the current page.

    Returns void

  • deprecated

    Parameters

    • forcedReload: boolean

    Returns void

replace

  • replace(url: string): void
  • Removes the current page from the session history and navigates to the given URL.

    Parameters

    • url: string

    Returns void

toString

  • toString(): string
  • Returns string

Generated using TypeDoc