var url = window.location.href; var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0];