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 240 views
1 answer 282 views
1 answer 217 views
2 answers 395 views
...