Forward and backward in ajax

I have a page with products that are filtered through ajax. Also the url changes via pushState. But when you click the backward and forward buttons in the browser, nothing happens, only the url changes. How to handle the clicks of these buttons?

Back to Top