Test HTMLAnchorElement.pathname

JavaScript

var a = document.createElement('a');
a.href = '/path/to/resource';
alert(a.pathname);