What's an easy way to get the url in the current window minus the domain name?

前端 未结 3 2042
离开以前
离开以前 2020-12-29 17:50

My Javascript ain\'t so hot, so before I get into some messy string operations, I thought I\'d ask:

If the current url is: \"http://stackoverflow.com/questions/ask\"

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 18:47

    alert(window.location.pathname);
    

    Here's some documentation for you for window.location.

提交回复
热议问题