Just use: Window.Location.getHostName().toString();

Easy, isn’t it?