How to get the hostname of the current web page in JavaScript

1 Answer

0 votes
document.write("The hostname of the current web page is: " + window.location.hostname);      
            
/*
run:
  
The hostname of the current web page is: localhost 
  
*/

 



answered Jul 13, 2015 by avibootz
...