Skip to content

Instantly share code, notes, and snippets.

View janernsting's full-sized avatar

Jan Ernsting janernsting

View GitHub Profile
@janernsting
janernsting / uri.js
Created April 21, 2012 07:15 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.host; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"