How to get the current URL domain in JavaScript

1 Answer

0 votes
const domain = window.location.hostname;

console.log(domain); 

  
    
    
/*
run:

"fiddle.jshell.net"
    
*/

 



answered Feb 18, 2021 by avibootz

Related questions

1 answer 171 views
2 answers 264 views
1 answer 274 views
...