How to get domain name from a URL in JavaScript

1 Answer

0 votes
const domainName =  window.location.hostname;

console.log(domainName); 


  
    
    
/*
run:
    
seek4info.com
    
*/

 



answered Jun 25, 2021 by avibootz

Related questions

1 answer 126 views
1 answer 189 views
1 answer 115 views
2 answers 255 views
...