Get complete domain name with protocol and port if available. #js #url

From http://stackoverflow.com/questions/6941533/javascript-get-protocol-domain-and-port-from-url