<!doctype html> <head> <title>Location object Basic Example</title> </head> <body> <p>Get Website Host name</p> <script> var x = location.hostname; document.write(x); </script> </body> </html>