allow javascript to use dynamic hostname and port