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.
<html> <body> <p id="domain"></p> <script> document.getElementById("domain").innerHTML = 'The domain name is :'+" "+document.domain; </script> </body> </html>
The domain name is www.tutorialspoint.com