var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
var u = new URL('https://toster.ru/q/368178')
console.log('Host is:", u.host);
hash: ""
host: "toster.ru"
hostname: "toster.ru"
href: "https://toster.ru/q/368178"
origin: "https://toster.ru"
password: ""
pathname: "/q/368178"
port: ""
protocol: "https:"
search: ""
searchParams: ""
username: ""
console.log('Current page host is:", location.host);