The window.location
property provides an object containing details about the current browser URL. This includes properties like the full URL, the pathname, protocol or hostname.
Some of the properties in the object logged above using window.location
are:
href
: The full URL of the current page.
pathname
: The path of the current page.
You can use these properties to access or manipulate the URL dynamically. For instance, you can redirect the user to another page or extract specific parts of the URL for processing.