window.location.pathname
seems to be what you want. For reference, you can enter window.location
(or any other object) into your JavaScript console to get its properties. For this page:
{
"ancestorOrigins":{
"length":0
},
"origin":"http://stackoverflow.com",
"hash":"#21613466",
"search":"",
"pathname":"/questions/21613356/how-do-i-get-the-property-that-comes-after-the-domain-name-using-javascript/21613466",
"port":"",
"hostname":"stackoverflow.com",
"host":"stackoverflow.com",
"protocol":"http:",
"href":"http://stackoverflow.com/questions/21613356/how-do-i-get-the-property-that-comes-after-the-domain-name-using-javascript/21613466#21613466"
}