Possible Duplicate:
Whats the difference between window.location.host and window.location.hostname
I’m looking at the window variable using the console and I notice that there are two different fields, one named host and the other hostname. After I’ve checked a few sites, there seems to be the same value in both. What is the difference between them? Which should be used for what purpose?
As specified by the definition:
So depending on your needs, you should use the one or the other. Most of the HTTP communication will go on default port 80, so you might omit it then. On the other hand, if you suspect that you need to take regard to non-standard port settings, you need to include that information in your source code as well.