how to delete a parameter with js
// Remove all Parameters
var url = new URL('http://demourl.com/path?topic=main');
// set search property to blank
url.search = '';
var new_url = url.toString();
// output : http://demourl.com/path
console.log(new_url);