JS - window.location built-in property

0 votes
172 views
added Mar 17, 2022 in Javascript by lcjr First Warrant Officer (11,850 points)
window.location.pathname // /cat/sub-cat

// For reference:

window.location.host     // www.example.com (including port if there's any)
window.location.hostname // www.example.com
window.location.hash     // #top
window.location.href     // http://www.example.com/cat/sub-cat?filter=a#top
window.location.port     // (empty string)
window.location.protocol // http:
window.location.search   // ?filter=a 

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...