Skip to content

Instantly share code, notes, and snippets.

function parseUrl(url) {
var urlParser = document.createElement('a');
urlParser.href = url;
return {
hostname: urlParser.hostname,
pathname: urlParser.pathname,
search: urlParser.search,
hash: urlParser.hash,
port: urlParser.port,