javascript hostname attribute


  Translation results:

host

English [həʊst] US [hoʊst]

n.[Computer] host; host, host; program host; hotel owner

vt.Be a host; host a banquet, host a program; entertain, be a host

vi.Be a host, be a host

Third person singular: hosts Plural: hosts Present participle: hosting Past tense: hosted Past participle: hosted

name

英[neɪm] 美[ nem]

n. Name; reputation; someone with the name of; a famous person

vt.Determine; decide; name...; say The name of…

adj.famous; based on which the name is named

Third person singular: names Plural: names Present participle: naming Past tense: named past Participle: named

javascript hostname attributesyntax

Function: A readable and writable string that can set or return the host name of the current URL.

Syntax: location.hostname

javascript hostname attributeexample

<html>
<head>
    <meta charset="UTF-8">
</head>

<body>

<script type="text/javascript">
    document.write(location.hostname);
</script>

</body>

</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A