Javascript: Window Location (URL)

Say we have this URL:

http://127.0.0.1:5500/index.html?a=111&b=222#x=888&y=999

window.location.protocol is http:

window.location.host is 127.0.0.1:5000

window.location.hostname is 127.0.0.1

window.location.port is 5000

window.location.pathname is /index.html

window.location.search is ?a=111&b=222

window.location.hash is #x=888&y=999

For full property, you can type window.location in the console log.

References: