diff --git a/files/en-us/web/api/location/hostname/index.md b/files/en-us/web/api/location/hostname/index.md index 456396bb36cc702..ab43ba36115e618 100644 --- a/files/en-us/web/api/location/hostname/index.md +++ b/files/en-us/web/api/location/hostname/index.md @@ -9,7 +9,7 @@ browser-compat: api.Location.hostname {{ApiRef("URL API")}} The **`hostname`** property of the {{domxref("Location")}} -interface is a string containing the domain of the URL. +interface is a string containing the {{glossary("domain name")}} of the URL. ## Value @@ -20,6 +20,11 @@ A string. ```js console.log(window.location.hostname); // developer.mozilla.org + +const anchor = document.createElement("a"); +anchor.href = "https://developer.mozilla.org:4097/"; +console.log(anchor.hostname === "developer.mozilla.org"); +// The port number is not included in hostname ``` ## Specifications