location.pathname
HTML
<div>
location.href = <span id="href" class="blue bold"></span>
</div>
<div>
location.pathname = <span id="location-pathname" class="red bold"></span>
</div>
<div>
anchor.pathname = <span id="anchor-pathname" class="green bold"></span>
</div>
CSS
.red {
color: red;
}
.blue {
color: blue;
}
.green {
color: green;
}
.bold {
font-weight: bold;
}
JavaScript
$(document).ready(function() {
var url = location.href;
$('#href').text(url);
$('#location-pathname').text(location.pathname);
var anchor = $('<a>', {href: url}).get(0);
$('#anchor-pathname').text(anchor.pathname);
});