window.location.hostname 

for deployment on PaaS where the localhost will not work