Interface

Location

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.

View Source js/lib.dom.d.ts, line 4713

Members

DOMStringList

# ancestorOrigins

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

View Source js/lib.dom.d.ts, line 4716

void

# assign

Navigates to the given URL.

View Source js/lib.dom.d.ts, line 4782

string

# hash

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 "#").

View Source js/lib.dom.d.ts, line 4721

string

# host

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.

View Source js/lib.dom.d.ts, line 4728

string

# hostname

Returns the Location object's URL's host.

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

View Source js/lib.dom.d.ts, line 4735

string

# href

Returns the Location object's URL.

Can be set, to navigate to the given URL.

View Source js/lib.dom.d.ts, line 4742

string

# origin

Returns the Location object's URL's origin.

View Source js/lib.dom.d.ts, line 4749

string

# pathname

Returns the Location object's URL's path.

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

View Source js/lib.dom.d.ts, line 4754

string

# port

Returns the Location object's URL's port.

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

View Source js/lib.dom.d.ts, line 4761

string

# protocol

Returns the Location object's URL's scheme.

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

View Source js/lib.dom.d.ts, line 4768

void

# reload

Reloads the current page.

View Source js/lib.dom.d.ts, line 4787

void

# reload

Deprecated:
  • Yes

View Source js/lib.dom.d.ts, line 4792

void

# replace

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

View Source js/lib.dom.d.ts, line 4796

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 "?").

View Source js/lib.dom.d.ts, line 4775