How can I get the URL Path of the current site, but without the last segment:
http://www.domain.com/first/second/last
I only need http://www.domain.com/first/second … with jQuery (or only JavaScript)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using pop and URL api
this assumes the URL is not likely to change
I use document.URL since that is what is recommended
Older answers: As requested by OP – with changes from comment
Here is an alternative