Document: location property - Web APIs | MDN
Value
A Location object. If the current document is not in a browsing context, the returned value is
null.
Although the location property itself is read-only in the sense that you can't replace the Location object, you can still assign to the location property directly, which is equivalent to assigning to its href property. You can also modify the Location object using the assign() and replace() methods.
Examples
js
console.log(document.location);
// Prints a Location object to the console
Specifications
| Specification |
|---|
| HTML # the-location-interface |
Browser compatibility
See also
- The interface of the returned value,
Location - A similar information, but attached to the browsing context,
Window.location