# How to show the domain name of the server that loaded the document with JavaScript?

HTMLJavascriptProgramming Scripts

To display the domain name of the server, use the domain property with JavaScript.

## Example

You can try to run the following code to show the domain name of the server that loaded the document −

Live Demo

<!DOCTYPE html>
<html>
<body>
<script>
var myDomain = document.domain;
document.write("<br>Domain name of the server that loaded the document: "+myDomain);
</script>
</body>
</html>
Published on 26-Feb-2018 12:33:28