在没有刷新网站的情况下使用网址更改淡出其他网页[已关闭]

I have online store, I want to click button and open popup window or modal, but i want to change url without refresh.

for example.

There are three products

Mobile PC Tablet

When I click Mobile (Mobile modal will open and url will be mysite.com/products/mobile But when I close this and open Tablet, I want url change to mysite.com/products/tablet, but without refreshing or redirecting.

Like this https://vp.ru/ When I clicked service button url changed without redirecting.

What you're looking for can be done with almost all modern web browsers. Take a look at the following article for more information on how to change the url without refreshing the page.

You basically need to call the pushState function when opening the modal:

window.history.pushState(stateObj, "Title", "/mobile");

Closing the modal will also need to modify the history to get back to the url without the mobile part.