In javascript, how can I get the relative path of the current url?
for example http://www.example.com/test/this?page=2
http://www.example.com/test/this?page=2
I want just the /te
/te
location.href.replace(location.origin,'');
Only weird case: http://foo.com/ >> "/"
http://foo.com/ >> "/"