The Location
interface represents 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.
Documentation Location by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
host:String
Is a DOMString
containing the host, that is the hostname, a ':'
, and the port of the URL.
href:String
Is a DOMString
containing the entire URL. If changed, the associated document navigates to the new page. It can be set from a different origin than the associated document.
Methods
replace(url:String):Void
Replaces the current resource with the one at the provided URL. The difference from the assign()
method is that after using replace()
the current page will not be saved in session History
, meaning the user won't be able to use the back button to navigate to it.
Throws:
null | DOMError |
---|