js get different part of url
var newURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname + window.location.search
Source: css-tricks.com
var newURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname + window.location.search