get window.location.pathname after appending js script code example Example: javascript get url path window.location.pathname