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