Window.location
Window.location
The Window.location
read-only property returns a Location
object with information about the current location of the document.
Though Window.location
is a read-only Location
object, you can also assign a DOMString
to it. This means that you can work with location
as if it were a string in most cases: location = 'http://www.example.com'
is a synonym of location.href = 'http://www.example.com'
.
See Location
for all available properties.
Location: href
The href
property of the Location
interface is a stringifier that returns a USVString
containing the whole URL, and allows the href to be updated.
Setting the value of href
navigates to the provided URL. If you want rediredtion, use Location.replace()
.