Easily parse an url with JavaScript :
var url = document.createElement('a');
url.href = 'http://www.mydomain.com/path?param=value'
and then we can access every properties of this element : http://www.w3schools.com/jsref/dom_obj_anchor.asp such as :
url.pathname //=>/path