Last active
August 1, 2021 13:34
-
-
Save tahirm/9737947 to your computer and use it in GitHub Desktop.
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var domain = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : ''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about :
window.location.origin
?