Web >> Development >> Javascript >> How to obtain the domain name part of the web server

var domainname=window.location.hostname.replace(/^www\./,'');