Skip to content Skip to sidebar Skip to footer

Whats The Difference Between Window.location.host And Window.location.hostname

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?

Solution 1:

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). www.google.com

Post a Comment for "Whats The Difference Between Window.location.host And Window.location.hostname"