how to get current domain name and port in javascript code example Example: get domain name javascript window.location.hostname