Given that I\'m on the following page:
http://www.webmail.com/pages/home.aspx
How can I retrieve the host name (\"http://www.webmail.
To get the hostname: location.hostname
But your example is looking for the scheme as well, so location.origin appears to do what you want in Chrome, but gets not mention in the Mozdev docs. You can construct it with
location.protocol + '//' + location.hostname
If you want the port number as well (for when it isn't 80) then:
location.protocol + '//' + location.host