Name
hostname — NN 2 IE 3 DOM 1
Synopsis
Read/Write
The combination of the hostname of the server (i.e., a
“two-dot” address consisting of server name and domain)
that serves up the current document. The hostname
property does not include the port number.
Example
if (location.hostname = "www.megacorp.com") { ... }
Value
String of hostname (server and domain).
Default
Depends on server.
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.