How to set a query parameter in URL without reloading the page by JavaScript

Add the following code in your JS support file: How to set a query parameter in URL without reloading the page by JavaScript How to set a query parameter in URL without reloading the page by JavaScript
var queryParams = new URLSearchParams(window.location.search);
			queryParams.set("color", "apricot");
			history.replaceState(null, null, "?"+queryParams.toString());
            newurl = window.location.href.replace('?color=','/');
            window.history.pushState('', '', newurl);	

How to set a query parameter in URL without reloading the page by JavaScript