javascript get path and id url code example Example: javascript get url path window.location.pathname