Replace the URL with a button without redirecting to that page

How can change the page URL with a button with switching to that page

I have a button on my site which filters results based on location & I have one more page which is filtered by a specific location.

What I want to do is that when I click on a button it filters it changes the page URL based on that page which is filtered by specific location

This is my code which filters location. but I don’t know how to write a code to change the URL of the page with being on the same page.

export function Location_click(event) {
//Add your code for this event here:
$w(“#PreloaderBox”).show();
console.log(“firtering item to Resonance”);
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘location’, ‘Location Name’))

. catch ((error) => {
let errorMsg = error.message;
let code = error.code;
} );
}

Hi,
If I understand correctly, the main goal is not changing the URL but displaying different content without changing the page.
If this is is the case, you can use dynamic item pages .

Basically, when you filter a dynamic page, it’s URL and content will change but the page remains the same.