tld.js
Version:
get the tld from a url
16 lines • 435 B
JavaScript
window.url = {};
window.url.parse = function(url){
var a = document.createElement('a');
a.href = url;
return {
href: a.href,
host: a.host || location.host,
port: a.port || location.port,
hash: a.hash,
hostname: a.hostname || location.hostname,
pathname: a.pathname,
protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol,
search: a.search,
query: a.search.slice(1)
};
};