Location: hostname
Syntax
string = object.hostname; object.hostname = string;
Examples
// 在文档流中声明了一个元素: <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/Location.hostname">
var anchor = document.getElementById("myAnchor");
var result = anchor.hostname; // Returns:'developer.mozilla.org'
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard hostname |
Living Standard | Initial definition. |
Browser compatibility
BCD tables only load in the browser