window.location

Javascript code posted
created at 07 Mar 11:54

Edit | Back
1
2
3
4
5
6
url = window.location
console.log(url.href);      // https://developer.mozilla.org/en-US/search?q=URL#search-results-close-container
console.log(url.hostname);  // developer.mozilla.org
console.log(url.pathname);  // /en-US/search
console.log(url.search);    // ?q=URL
console.log(url.hash);      // #search-results-close-container
338 Bytes in 4 ms with coderay