get domain from string javascript code example Example: get domain name javascript window.location.hostname