Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
pathinfo = function(url)
{
	a = document.createElement('a');
	a.href = url;
	return a;
}

parser = pathinfo( "https://test.com:8080/pathname/?param=foo#hash");

parser.protocol; // => "https:"
parser.host;     // => "test.com:8080"
parser.hostname; // => "test.com"
parser.port;     // => "8080"
parser.pathname; // => "/pathname/"
parser.hash;     // => "#hash"
parser.search;   // => "?param=foo"
parser.origin;   // => "httphttps://test.com:8080"