js get domain name from url code example
Example 1: get domain name javascript
window.location.hostname
Example 2: javascript regex get domain from url
function url_domain(data) {
var a = document.createElement('a');
a.href = data;
return a.hostname;
}