var url = window.location.hostname; // obter o dominio var url_splt = url.split('.') var url_name = url_splt[url_splt.length - 2]; alert(url_name);