Javascript examples for DOM:Document domain
The domain property returns the server domain name that loaded the document.
A String, representing the server domain name that loaded the document. It returns null if the domain of the document cannot be identified
The following code shows how to get the domain name of the server that loaded the document:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">display the domain name of the server that loaded this document</button> <p id="demo"></p> <script> function myFunction() {// w w w.j av a 2s . c om var x = document.domain; document.getElementById("demo").innerHTML = x; } </script> </body> </html>