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 172 views
2 answers 267 views
1 answer 275 views
...