var link = ...; // Any URL var a = document.createElement('a'); a.href = link; a.pathname; // The path portion a.host; // The host ...
The trick is that the
<a> element implements the
Location methods! Neat!
The a element also supports the URLUtils interface. [URL]