JavaScript
Article
By Sam Deering

JavaScript location.host vs location.hostname

By Sam Deering

JavaScript location.host vs location.hostname example for this domain address http://jquery4u.com

location.host gives us jquery4u.com
location.hostname gives us jquery4u.com

You may be wondering, whats the difference?

Well host takes into consideration any specific ports also!

ports

--ADVERTISEMENT--

Try it below!

Check out this awesome site below.

source:
http://bl.ocks.org/abernier/raw/3070589/

Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account