how to get path from url javascript code example Example: javascript get url path window.location.pathname