Because the subject title is a bit inconsistent with the body of the message, then I will try to summarize both.
If you want to really use anchors, including the need to have them in the address bar, i.e. the view was of the type: http://mysite.ru/#users , then you can use the API to work with the history in the browser. In particular, you need the pushState method pushState You can read more about it on for example here.
If you, judging from the message itself, it is precisely the presence of links in the address bar to which the call was made, then try to get acquainted with pjax (pushState + ajax) . It just includes working with the history API and you do not have to take on the work with the logic of history. The content will also be taken through ajax , while the links will be necessary.
One option is HERE
This particular pjax version does not work with anchors. If you are lazy and do logic based on the history API yourself and at the same time need anchors, then there are various kinds of pjax forks that allow support for hash navigation, for example , this
pjaxtowardspjax. for example, from here ... you can run through the site viaajaxand the links will be necessary. - Alexey Shimanskyякорей. As far as I remember,pjaxdoes not support anchors (fallback for old browsers), butpushState()is the personal preference of thepjaxauthor. - romeopushState()aboutpushState()from Mikhail Davydov (former yandex employee). - romeopjax. If you really want anpushState, and anchors are desperately needed, then yes - you can push-up) - Alexey Shimansky