how to get part of the url javascript code example Example: javascript get url path window.location.pathname