# How to display the domain of the server that loaded a document in JavaScript?

JavascriptObject Oriented ProgrammingFront End Technology

Javascript has provided document object to get any detail regarding a document. It has provided document.domain to get the domain of the server in which document loaded.

### Example

In the following example, the document is loaded in "tutorialspoint" server. Therefore the domain which we will get is "www.tutorialspoint.com". Document.domain is an inbuilt function used to get the domain of the server in which the document is loaded. When this method is used in the "tutorialspoint" server, the domain with respect to the "tutorialspoint" is loaded as shown in the output.

Live Demo

<html>
<body>
<p id="domain"></p>
<script>
document.getElementById("domain").innerHTML =
'The domain name is :'+" "+document.domain;
</script>
</body>
</html>

### Output

The domain name is www.tutorialspoint.com
Published on 26-Jul-2019 16:19:21