I am looking for plain JavaScript code (no jQuery etc.) to learn the directory path component of my currently loaded page\'s URL.
For instance, if my page is loaded
Highlighting the comment in the question that helped me:
Phylogenesis's comment:
The simple solution is location.href.replace(/[^/]*$/, ''); then.