Javascript: Get host info

PHOTO EMBED

Mon Aug 29 2022 18:52:13 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #javascript

var url = new URL("",location);

console.log(url.host); // ip address or hostname:port number
console.log(url.protocol); // protocol
console.log(url.hostname); // ip address or hostname
console.log(url.port); // port number
console.log(url.origin); // protocol://ip address or hostname:port number

console.log(url.pathname); // /current path/
content_copyCOPY

Information about host url