Location

external class Location(source)

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.

MDN Reference

Properties

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Returns the Location object's URL's host.

Link copied to clipboard

Returns the Location object's URL.

Link copied to clipboard

Returns the Location object's URL's origin.

Link copied to clipboard

Returns the Location object's URL's path.

Link copied to clipboard

Returns the Location object's URL's port.

Link copied to clipboard

Returns the Location object's URL's scheme.

Link copied to clipboard

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

Functions

Link copied to clipboard
fun assign(url: String)

Navigates to the given URL.

fun assign(url: URL)
Link copied to clipboard
fun reload()

Reloads the current page.

Link copied to clipboard
fun replace(url: String)

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

fun replace(url: URL)