Typically, fake pages in an AJAX application change the request with the addition of something after # , for example www.mypage.com/#products . If you try to change the URL to another URL in JavaScript, the browser will redirect it to this page. However, if the change occurs after # , it will remain on the page (and try to place an element with this ID at the top of the browser window).
So, you can try something like the following JavaScript to set the url:
window.location.hash = 'products';
You can then find this when the page loads so that you know which page you need to get.
There are also many predefined JavaScript libraries that make sure that the story works correctly in these scenarios, although I donβt know enough to recommend a specific library.
source share