Skip to content

Instantly share code, notes, and snippets.

@raym
Created April 23, 2015 04:56
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