Created
June 4, 2015 15:30
-
-
Save jbourgein/f5944ac4f5098b300c85 to your computer and use it in GitHub Desktop.
get just the host from a url string
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
function getHostFromUrlString(url){ | |
var url = "www.a.host.com/sub/super.html?id=123"; | |
var tempA = document.createElement('a'); | |
tempA.href = url; | |
return tempA.hostname; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment