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 139 views
1 answer 198 views
1 answer 125 views
2 answers 264 views
...