how to know domain name of url javascript code example Example: get domain name javascript window.location.hostname