How to get  URL without any parameters in JavaScript? Let's say you want to get current URL  and strip all query parameters, there is a very easy way by using window.location

So. we will use window.location and split method to strip all query params:

window.location.href.split('?')[0]

                    window.location.href.split('?')[0];
//'https://floyk.com/en/post/javascript-get-url-without-query-paramaters'