Get The Current Domain Name With Javascript (Not the path, etc.)

How about:

window.location.hostname

The location object actually has a number of attributes referring to different parts of the URL

Leave a Comment