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