They both seem to give me the same thing (the domain name currently executing the script).
So what’s the difference (if any) and where should each be used?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MDN Web Docs – window.location
host....: the host name and port number. [www.google.com]:80hostname: the host name (without the port number or square brackets). http://www.google.com