Skip to content

Instantly share code, notes, and snippets.

@raym
Created April 23, 2015 04:56
Show Gist options
  • Save raym/24b5da96d4df136fae0f to your computer and use it in GitHub Desktop.
Save raym/24b5da96d4df136fae0f to your computer and use it in GitHub Desktop.
small js function to get the domain of a url
function getDomain(url) {
var a = document.createElement('a');
a.href = url;
return a.hostname;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment