Hi @crdlc ! Thanks for your comments ;-) BTW, what about:
var COMMS_APP_ORIGIN = document.location.protocol + '//' + document.location.host;