JS: Get URL (window.location)
This page shows you how to get the URL using
The window.location object contains URL info. You can use it like this:
console.log(window.location.href); // sample output // http://example.org/
window.location object has the following properties. Their values are string.
|the host name and port number (if the URL has port number)|
|pathname, with beginning slash|
|the part of url after |
|part of URL after |
If you set
window.location.href the browser will load it.
You can open your
Browser's JS Console
window.location.href to see its value.
JS: Encode URL, Escape String
If you have a question, put $5 at patreon and message me.