JavaScript obtenga la ubicación de la ventana actual sin parámetros

const url = window.location.origin + window.location.pathname
//http://example.com/somedir/somefile/
Impossible Ibis